storage: CPut ConditionFailed updates the timestamp cache#21297
storage: CPut ConditionFailed updates the timestamp cache#21297spencerkimball merged 1 commit intocockroachdb:masterfrom
Conversation
Release note: None
414e612 to
70ef0e1
Compare
|
Also, do you mind expanding the commit message to point out that this fixes a serializability violation with CPuts? Maybe also expand on what the implications of that violation were. Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. pkg/storage/replica.go, line 2055 at r1 (raw file):
I'd restructure this so that the Comments from Reviewable |
|
Is this a bug fix or an improvement? As I understood, CPut ConditionFailed didn't need to update the timestamp cache because the transaction was always ended after a ConditionFailed error was detected. Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. Comments from Reviewable |
|
My POC on improving serializable restarts caused me to take a closer look at how things must update the timestamp cache and this popped out as being obviously wrong. @jordanlewis, imagine the following example:
@nvanbencschoten, I added the above example to the commit message. Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. pkg/storage/replica.go, line 2055 at r1 (raw file): Previously, nvanbenschoten (Nathan VanBenschoten) wrote…
The chance of that being something we need seems vanishingly unlikely. Comments from Reviewable |
|
Thanks for the clear example! That makes sense. Yikes! I wonder if any of our Jepsen tests include workloads that exercise conditional put failures. Would this kind of thing have been caught if they did include such tests? Review status: 0 of 3 files reviewed at latest revision, 1 unresolved discussion, all commit checks successful. Comments from Reviewable |
|
I don't think we have any jepsen tests that exercise this, but it should be possible to construct a test that would catch it. Review status: 0 of 3 files reviewed at latest revision, 2 unresolved discussions, all commit checks successful. pkg/storage/replica.go, line 2074 at r1 (raw file):
It's unfortunate that we have both a flag in api.go and an entry in the switch statement here - the flags are less valuable if they just need to be synchronized with other code. Of course, this switch case isn't strictly necessary - it would still be correct to update the tscache for any error from ConditionalPut (or even for any error on any command that updates the tscache). Should we just do that instead of trying to narrowly target certain errors from certain commands? We'd push the timestamp cache forward more than we otherwise would, but it doesn't seem like that would be much of a problem. Comments from Reviewable |
|
Review status: 0 of 3 files reviewed at latest revision, 2 unresolved discussions, all commit checks successful. pkg/storage/replica.go, line 2074 at r1 (raw file): Previously, bdarnell (Ben Darnell) wrote…
I really think it's safer to avoid changes to existing behavior where possible. Given that, I really needed to add this case in order to examine the error in the context of the request. Comments from Reviewable |
Here's an example:
Release note: None