Repository navigation
Fix persisted success replies surviving a rolled back request transaction - #10163
Merged
Merged
Conversation
🦋 Changeset detectedLatest commit: 3422eb8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Inside a
ClusterSchema.WithTransactionrequest, the persisted success reply is saved on the request transaction's connection withretryRespond(4, ...). On MySQL/MariaDB, a deadlock during that save rolls back the whole transaction, so the retries run outside any transaction and autocommit the success reply. The request transaction then fails, butsettlefinds the stored reply viahasStoredExit, treats it as a successful commit, and never replays the handler. The caller gets a success while the handler's writes are lost.This change saves a persisted success reply inside a request transaction once, without retries. If the save fails, the transaction fails and rolls back, no reply is stored, and
settlereplays the request.Unchanged:
settle) and chunks keep their retrieshasStoredExitPersistenceError.refaildefect handling and the MySQL clientNot covered: streaming handlers. Stream chunks in a persisted
WithTransactionrequest are still saved withretryRespond(4, ...).ClusterSchema.WithTransactionalready documents that chunks are saved outside the transaction's atomicity, and a deadlock on a chunk save needs a MySQL driver-side fix (rejecting statements after the server aborts the transaction, viaSERVER_STATUS_IN_TRANS), which is out of scope here.Tests
Adds a
Shardingregression test that wraps memory storage to behave like MySQL after a deadlock: the first in-transactionsaveReplyaborts the transaction, later saves autocommit, and the transaction fails. It fails without the fix (expected [ true, 1 ] to deeply equal [ true, 2 ]) and passes with it. All cluster tests pass.Closes #10162
Closes EFF-3151