-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kv: disallow parallel commit of batch with read-only requests #44608
kv: disallow parallel commit of batch with read-only requests #44608
Conversation
I could rubber stamp this, the change looks fine and like it's doing what it says it does, but would we prefer a real review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but to be honest I'm not sure what semantics we want for reads in the commit batch. I think you can argue for committing even if these reads fail. But we can punt until we have a better error recovery story.
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei, @danhhz, and @nvanbenschoten)
pkg/kv/txn_interceptor_committer.go, line 279 at r1 (raw file):
// canBatchCommitInParallel determines whether the batch can issue its // committing EndTxn in parallel with the rest of its requests. func (tc *txnCommitter) canBatchCommitInParallel(
The new name doesn't mean much to me. How about just canCommitInParallel
?
And I'd rephrase the comment too; it's not just about committing in parallel with the other requests in this batch, but also with the in-flight writes.
b66c6c3
to
0f03869
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors r+
Reviewable status: complete! 0 of 0 LGTMs obtained (waiting on @andreimatei and @danhhz)
pkg/kv/txn_interceptor_committer.go, line 279 at r1 (raw file):
Previously, andreimatei (Andrei Matei) wrote…
The new name doesn't mean much to me. How about just
canCommitInParallel
?
And I'd rephrase the comment too; it's not just about committing in parallel with the other requests in this batch, but also with the in-flight writes.
Done.
Build failed (retrying...) |
Build failed |
bors r+ |
Fixes cockroachdb#44315. This commit fixes an issue where KV batches with read-only requests were allowed to be issued as parallel commits. This should not have been allowed because the outcome of these read-only requests, notably Get and Scan requests, is not taken into consideration by the status resolution process for STAGING transactions. This would have caused serious atomicity issues if parallel commit batches (non-1PC committing batches) were issued with read-only requests by users of the KV API. Luckily, in practice that wouldn't actually happen as we never issue batches like that so there's no concern about production clusters hitting this bug. Still, this is a very good catch as this was a serious footgun and fixing this hardens the KV API. We should also still backport this to v19.2 just to be safe. Release note: None
0f03869
to
56a9934
Compare
Hello bors?
bors r+ |
44608: kv: disallow parallel commit of batch with read-only requests r=nvanbenschoten a=nvanbenschoten Fixes #44315. This commit fixes an issue where KV batches with read-only requests were allowed to be issued as parallel commits. This should not have been allowed because the outcome of these read-only requests, notably Get and Scan requests, is not taken into consideration by the status resolution process for STAGING transactions. This would have caused serious atomicity issues if parallel commit batches (non-1PC committing batches) were issued with read-only requests by users of the KV API. Luckily, in practice that wouldn't actually happen as we never issue batches like that so there's no concern about production clusters hitting this bug. Still, this is a very good catch as this was a serious footgun and fixing this hardens the KV API. We should also still backport this to v19.2 just to be safe. Release note: None Co-authored-by: Nathan VanBenschoten <[email protected]>
Build succeeded |
This was missed in cockroachdb#44608. I noticed while backporting that change in cockroachdb#44703.
Fixes #44315.
This commit fixes an issue where KV batches with read-only requests were allowed
to be issued as parallel commits. This should not have been allowed because the
outcome of these read-only requests, notably Get and Scan requests, is not taken
into consideration by the status resolution process for STAGING transactions.
This would have caused serious atomicity issues if parallel commit batches
(non-1PC committing batches) were issued with read-only requests by users of the
KV API. Luckily, in practice that wouldn't actually happen as we never issue
batches like that so there's no concern about production clusters hitting this
bug. Still, this is a very good catch as this was a serious footgun and fixing
this hardens the KV API. We should also still backport this to v19.2 just to be
safe.
Release note: None