-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Do not return TransactionAbortedError when rolling back an aborted txn #5885
Conversation
I like the idea of letting an On the other hand, your change seems to go further and is half-way to getting rid of Reviewed 7 of 7 files at r1. storage/replica_test.go, line 1771 [r1] (raw file): storage/replica_test.go, line 2097 [r1] (raw file): Comments from Reviewable |
Not getting an error in the deadline exceeded case seems particularly problematic, since the caller (or grand-caller) of the transaction is unlikely to inspect the txn proto (or even have access to it) after EndTransaction. Reviewed 7 of 7 files at r1. client/txn.go, line 83 [r1] (raw file): Comments from Reviewable |
Ah, I see. The idea was briefly mentioned in #3037:
If I understand correctly, this allows us to commit a batch and update a transaction record. We can instead tweak I thought a caller can still inspect an error since we convert a nil-error to Having said, I totally agree that the change is (very) brittle. Let me try getting rid of the part and see if just making the change to the rollback part works. Thanks! |
Ah, I missed that - that seems right. We just need to adjust the tests so we can demonstrate how a user of a transaction with a deadline would actually see an error (currently the tests are changed to inspect the proto). |
I'm against changing the deadline semantics at this point. Let's keep it simple and swallow errors only if the intention was to abort and there is indeed a transaction aborted proto. That way the only change in semantic is that you don't fail to abort if someone else did it for you already. If you're attempting to commit with a deadline constraint, I think you should get the error - what you wanted to happen did not happen. |
d33847d
to
3b8d91f
Compare
Sure, updated the PR. It is now simple and just changes |
Reviewed 7 of 7 files at r2. storage/replica_command.go, line 371 [r2] (raw file): storage/replica_command.go, line 372 [r2] (raw file): storage/replica_command.go, line 416 [r2] (raw file):
storage/replica_test.go, line 2128 [r2] (raw file): Comments from Reviewable |
Change Replica.EndTransation to return a nil-error when it finds a transaction that has already been aborted, but the request is requesting a rollback (Commit = false).
3b8d91f
to
066b1f9
Compare
Thanks for the review! Review status: 0 of 2 files reviewed at latest revision, 7 unresolved discussions. storage/replica_command.go, line 371 [r2] (raw file): storage/replica_command.go, line 372 [r2] (raw file): storage/replica_command.go, line 416 [r2] (raw file): storage/replica_test.go, line 2128 [r2] (raw file): Comments from Reviewable |
This is a follow-up of #5885. Resolve local intents and update the transaction record when we attempt to roll back the transaction and find that it has already been aborted. Define helper method resolveExplicitIntents and call it.
This is a follow-up of #5885. Resolve local intents and update the transaction record when we attempt to roll back the transaction and find that it has already been aborted. Define helper method resolveExplicitIntents and call it.
(I was curious if we can fix #3037 (and #1989). The change introduces some complexity and I'm not totally sure we should fix these issues.)
This commit changes EndTransaction to return nil error on txn abort so that the we can commit a batch and update the transaction record.
Change txnSender.Send so that it convert a nil error to TransactionAbortedError so that txn.Exec will initiate a restart. This change is hacky, but I couldn't come up with a better approach.
We still return TransactionAbortedError in other places and keep the code path for handling TransactionAbortedError.
This change is