-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This patch refactors the way ambiguous errors are returned from the evaluation of requests. Before this patch, the situation was confusing and buggy: the responsibility for generating these errors was split between Replica.executeWriteBatch() and the lower lever Replica.tryExecuteWriteBatch(). The latter was returning both errors and so called "retry reasons", except that some retry reasons were not actually resulting in retries. The reasons in question were returned together with an error, which was in blatant violation of proposalResult comment that said that exactly one of these guys can be set. I believe the fact that both an error and a retry reason was set was also causing the timestamp cache updating code to be buggy, I think: https://github.com/cockroachdb/cockroach/blob/a5eddb23cbb7db5cbb9655b8ed7a1875779b3c62/pkg/storage/replica.go#L2214 The code says that we update the ts cache if the request is not to be retried, but it was missing cases. The actual ambiguous errors were sometimes generated in tryExecuteWriteBatch (for reason proposalRangeNoLongerExists) and sometimes in executeWriteBatch (for reason proposalErrorReproposing), which was confusing. This patch does away with the troublesome retry reasons and removes any responsibility around creating ambiguous errors from executeWriteBatch. The lower layers know whether the conditions they're reporting should return in ambiguous errors or not, and so they create ambiguous errors directly. This patch changes the errors returned for some non-commit requests when the reason is proposalErrorReproposing: it used to be a non-ambiguous error and now it will be an ambiguous one. executeWriteBatch used to discriminate between commit and non-commit batches, but that was inconsistent (it didn't take effect for proposalRangeNoLongerExists) and, more importantly, it was the wrong layer to take commits into consideration (in my opinion). Release note: None
- Loading branch information
1 parent
2e7dac6
commit 80eea9e
Showing
1 changed file
with
47 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters