🐛 fix(storage): replay the outcome the transaction read - #2016
Merged
Conversation
A finalize retry that found a terminal outcome inside its write transaction threw that record away and read the row again once the transaction had ended. The write-ledger reaper deletes expired terminal outcomes on its own schedule, so it could delete the row in that window. The second read then returned None and the expect panicked, failing a retry whose answer the transaction had already held. FinalizeFlow::RaceReplay now carries the record, leaving no second read for retention to race. Splitting live state away from the pruned table, the remedy #1388 needed, does not apply here: OPERATION_OUTCOME is the idempotency ledger itself and evicting expired terminal rows is what its retention is for. Closes #1374
Merging this PR will not alter performance
Comparing Footnotes
|
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.
A finalize retry that found a terminal outcome inside its write transaction discarded that record, and
resolve_finalizeread the row back from the store after the transaction had ended.write_ledger_reaprunsprune_operation_outcomeson its own schedule and deletes terminal outcomes past their retention cutoff, so it can delete that row inside the window. The second read returnsNoneand theexpectpanics witha race-replay observed a terminal outcome that is still stored. Nothing catches that panic. The finalize task never sends a response, so a client retrying an upload that had already published loses the connection instead of getting the acknowledgement the transaction was holding, and the operator reads a panic for a request that was correct.FinalizeFlow::RaceReplaynow carries theOperationOutcomeRecordthe transaction observed, and the replay returns that value, leaving no second read for the reaper to race.resolve_finalizeno longer touches the store and drops to a free function over the flow.flowchart LR Txn[Finalize transaction<br/>reads terminal outcome] --> Flow[RaceReplay carries the record] Txn --> Prune[Reaper deletes the expired row] Flow --> Resolve[Replay returns the observed record] Prune -. no longer reaches .-> Resolve classDef accent fill:#cfe4ff,stroke:#1f6feb,color:#0b1f3a; classDef warn fill:#ffe3a3,stroke:#d29200,color:#3a2c00; class Txn,Flow,Resolve accent; class Prune warn;#1388 was the same defect in the policy-decision tables and took a different remedy. There a bounded audit log held live state, so live state moved to a table the pruner does not touch.
OPERATION_OUTCOMEis the idempotency ledger and evicting expired terminal rows is what its retention exists for, so this change drops the redundant read and leaves the pruner alone.Closes #1374