Repository navigation
Conversation
A handler wrote to the application's tables in a transaction of its own, before the runner recorded the job complete in another, so a runner that died between the two ran the job again and wrote twice, and every application kept its writes idempotent by hand. handle_committing has the handler answer its write, which the runner makes in the transaction that completes the job, after the statement guarded by the lease: the job is completed and the write made together, or neither, and a runner whose lease was taken makes none. A write that fails rolls the completion back and is the attempt's failure. Saving results for spool to keep, and awaiting them, was weighed and left out: the application's own tables are where its results belong.
This branch has not been deployed
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.
Why
A handler wrote to the application's tables in a transaction of its own, before the runner recorded the job complete in another, so a runner that died between the two ran the job again and wrote twice. Saving results for spool to keep, and awaiting them, was weighed and left out: the application's own tables are where its results belong.
Changes
Spool.handle_committing: a handler answers a write, made in the transaction that completes its job, after the statement guarded by the lease; the job is completed and the write made together, or neither.Spool.handleis unchanged: a handler with nothing to write is written as before.Verified
make lintandmake test: 83 tests, six new against a real Postgres, each seen failing when the write ran without the lease or a failed write was ignored.make docs: the site built, its link check passing.