Repository navigation
3.x.x: learn the restart test's background statements after a landing, and keep its claim transaction whole (#729) - #792
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
…, and keep its claim transaction whole (#729) a_relaunched_frontend_recovers_one_row_at_the_same_statement_cost_at_both_cardinalities failed three ways. All three are faults in the measurement, not in the server. 72 vs 65 (PostgreSQL shard 2, in five CI runs since Oct 22). - The idle windows that learn the relaunched child's background statements ran before it had accepted any block. - The metrics collector looks up orphan evidence only for blocks this process registered as accepted. The recovered row's own active observation (Metrics::accepted_block) registers one inside the measured span. - No miner connects to close it, so every ten-second tick after that runs the lookup. Its text was never seen idle, so a tick inside the span was counted as a 7-statement foreground transaction. 61 vs 65 (Oct 6). The 99-row run lost four statements of the recovered row's own claim transaction: BEGIN, the writer fence, the claim survey and COMMIT. - Since #581, the first claim poll after the release takes the row over, ahead of every sibling. - That poll sent BEGIN and the fence before the measured window's mark, and the survey after the release committed. - So runs() over the executions since the mark split the transaction into runs of one, and kept only the takeover. Three bare ROLLBACKs (once, on the rebased branch). - The job/blob pruner runs a write transaction every two seconds, inside a five-second timeout_at that covers its COMMIT. That COMMIT waits for a WAL flush. - When a stalled flush holds the COMMIT past the budget, the future is dropped mid-COMMIT. SQLx then sends a ROLLBACK behind the COMMIT, which the server completes anyway. - The result is a ROLLBACK outside any transaction, a run of one that no idle window need ever see. It depends on the host's disk, not on the scenario's state. The change: - The relaunched child now lands one sibling after a first idle window, which together with the launch covers its startup, and before the window the background set settles in. - The background set is everything the child ran outside that landing. So every background statement that only an accepted or landed block switches on is seen while idle, whichever loop runs it, without the test naming any of them. - The node must have been offered that sibling once, and the recovered block no more than before. - The measured executions now start at the verification window instead of the release, so a run that reaches the recovered row's span is rebuilt from its BEGIN. The span alone still decides what counts. - Transaction control (BEGIN, COMMIT, ROLLBACK, SAVEPOINT, RELEASE) no longer makes a run foreground on its own. It is read from the server's completion tags, or from a single-statement text when the proxy could not pair them. - Why that can't hide recovery work: BEGIN and COMMIT are in every background set, so each recovery transaction was already selected through a statement of its own. The pinned sequence has no ROLLBACK or savepoint, and a taken run still counts every statement it has. - Unchanged: the pinned 65, the equality across cardinalities, the empty selection on the verification window, the unfinished-count difference and #266's no-second-offer check. The doc comments now say the row is taken over ahead of every sibling, not claimed by the oldest-due lane behind them. They also say a per-sibling loop in the due-work probe or the claim lanes costs the siblings' claims, which this test does not measure; a per-sibling loop in the claim survey a takeover shares is still caught. Tests: uncommitted experiments forced each interleaving with the execution proxy's own pauses. - Holding the recovered row's landing COMMIT for 12 s, past one collector tick, failed the base test with "72 statements with 23 rows behind it and 65 with 99". With this change, the lookup inside the span was background, and both counts were 65. - Holding the claim poll's fence reply across the mark and the release failed the base test with "65 with 23 and 61 with 99". With this change, the transaction was rebuilt whole and counted 65. - Holding the pruner's COMMIT reply for 6 s, past its budget, reproduced CI's three bare ROLLBACKs in the verification window, and "66 with 22 and 65 with 98" inside the span. It did so with and without #788. With this change, both passed at 65 and 65. - The full candidate_storm_restart binary passed 21 of 21 in six runs on private PostgreSQL 16 clusters. Each run recorded restart_recovery_statements at 65 and 65. Refs #729. Co-Authored-By: Claude Opus 5.5 <[email protected]>
kiwidream
force-pushed
the
kiwidream/729-recovery-background-set
branch
from
October 27, 2026 19:24
6555ff4 to
06a7832
Compare
This was referenced Oct 28, 2026
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.
Fixes the flaky
candidate_storm_restart::a_relaunched_frontend_recovers_one_row_at_the_same_statement_cost_at_both_cardinalities(#729). The change is test-only. The test failed in three ways, and all three were faults in how it measured, not in the server.The three failures
72 vs 65. PostgreSQL shard 2 failed this way in 5 of 23 completed CI runs since Oct 22, #788 twice in a row among them.
Metrics::accepted_block) registers one inside the measured span.61 vs 65. This is the Oct 6 failure #729 was filed for. It was not an extra background transaction, as the issue first said: the 99-row run lost four statements of the recovered row's own claim transaction.
BEGINand the writer fence before the measured window's mark, and the claim survey after the release.runs()over the executions since the mark therefore split the transaction into runs of one, and kept only the takeover.Three bare
ROLLBACKs. This happened once, on this branch, during review.timeout_atthat also covers itsCOMMIT.COMMITpast the budget, the future is dropped mid-COMMIT, and SQLx sends aROLLBACKbehind it. The server completes theCOMMITanyway.ROLLBACKoutside any transaction. It depends on the host's disk, not on the scenario's state, so no idle window need ever see it.The change
BEGIN, and the span alone still decides what counts.BEGIN,COMMIT,ROLLBACK,SAVEPOINTandRELEASEno longer make a run foreground on their own. They are read from the server's completion tags, or from a single-statement text when the proxy couldn't pair them.BEGINandCOMMITare in every background set, so each recovery transaction was already selected through a statement of its own.ROLLBACK, and a taken run still counts every statement it has.Tests
The fix was proven with two experiments. Each was run on the base and on the change, using the execution proxy's own pauses. Neither is committed.
COMMITfor 12 s (pause_after_commit) puts one collector tick inside its span.pause_statement), at 100 rows.BEGIN, the fence, the survey andCOMMIT.COMMITreply for 6 s, past its budget, needs a statement-level marker trigger pluspause_after_commit.ROLLBACKs in the verification window, and "66 with 22 and 65 with 98" inside the span. It happened with and without 3.x.x: wait out commit-gate contention and append again, so a lease's share keeps its credit (#716) #788.Local runs on minidev-alex1, private PostgreSQL 16:
test/prism-native-tests.sh cargo-args --locked -p qbit-prism-server --test candidate_storm_restart -- --test-threads=4 --nocapturepassed 21 of 21 three times onf58fe24d, and three times with theROLLBACKfix on3dbe288a. Every run recordedrestart_recovery_statementsat 65 and 65.TMPDIRon disk at a short path: the host's/tmpquota kills PostgreSQL ("Disk quota exceeded"), and a long path breaks its socket limit.cargo fmt --all -- --checkandcargo clippy --locked --workspace --all-targets -- -D warnings: clean.A review pointed out that learning background statements from idle windows still depends on reaching the right state first. A background statement that only some later state switches on (a reconciliation row, a parked row) would need its own warm-up. A design that attributes executions by origin, for example a per-loop
application_namerecorded by the proxy, would remove that class entirely, but it needs a server change, so it is out of scope here.Fixes #729.
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.