Repository navigation
test: am_contracts' older-snapshot arm waits for its events instead of sleeping - #1417
Merged
Merged
Conversation
87 tasks done
OffgridwithJD
approved these changes
Oct 15, 2026
OffgridwithJD
left a comment
Collaborator
There was a problem hiding this comment.
Approved at 8bf3cbf.
- The fix: the older-snapshot arm is now ordered by events. A gate session takes advisory lock 4242 and only then names itself. Session 1 takes its REPEATABLE READ snapshot, names itself and queues on the lock. The script waits for that name, runs the DELETE and CREATE INDEX, then ends the gate. A new premise checks that the snapshot counted 10000 rows.
- Red (PG17), the stated mutant: the index build with
PgColumnarReadSetEmitDeleted(readState, false)(.so b9726239 -> ca727fa0). Shell 27 + 1:an index built after a delete finds the row for an older snapshot that sees it: got [0] want [1]. Twin 1 failed, 6 passed, same text. - The wait can't pass vacuously, and it fails when the event never comes:
- With
SET application_name = 'ib_snap'removed, the loop times out after 30s and the run is 27 + 1:premise: the older snapshot was taken before the delete: got [no (gate 891671, snapshot none)] want [10000]. - With session 1's
pg_advisory_lock_shared(4242)replaced bySELECT 1, the run is 26 + 2, includingpremise: the older snapshot's lookup is an index scan: got [0] want [1]. So the gate is what makes the plan come after the index. - With
sleep 5added beforeCREATE INDEX, the run is 28/28.
- With
- Green: shell 28/28 and twin 7 passed on PG17 and PG18. The ledger, 2775 rows / 2096 never / 679 dated, matches the tsv, the gate agrees against origin/main, and the new name has its row.
🤖 Generated with Claude Code
…1341 item 50) Two finite float8s, or two finite reals, whose sum is infinite raise "value out of range: overflow" (22003) in core's float8pl and float4pl. The grouped node's accumulators carry the same check, and nothing tested it: only avg's overflow had an arm, in the shell alone. native_groupagg gains the sum arm in both twins, judged by SQLSTATE against core with the node off, plus a check that the node fires. Removing either accumulator's check reddens its own position. native_groupagg enters the ledger seeded; suites_not_covered 234 -> 233. cluster_tests +1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019VvWuX1zUwk6Y513waRd4N
…#1407) older snapshot still finds a recently deleted row by a new index. But it emitted every deleted row, where heap's build skips a tuple dead to all. So REINDEX, documented as what reclaims stale entries, reclaimed none: 9 rows in 10 deleted, and the rebuilt index kept its size where heap's shrank to a tenth. The build now also reads each row group's delete marks under a horizon snapshot (xmin = xmax = the oldest non-removable xid, curcid 0), which sees exactly the transactions committed before every running snapshot began, and leaves out a row deleted there. The snapshot is registered: PG 18+ asserts it in the visibility check. am_contracts gains the arm in both twins, red on main (kept:2260992-> 2260992); with the horizon moved to the next xid, the older-snapshot arm goes red instead. limitations.md says when REINDEX keeps an entry. cluster_tests +1. Fixes #1407. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019VvWuX1zUwk6Y513waRd4N
…f sleeping The arm from #1364 held a REPEATABLE READ snapshot, slept four seconds, and assumed the DELETE and CREATE INDEX finished inside them. On a loaded box they did not: the plan was taken before the index existed, and 'premise: the older snapshot's lookup is an index scan' read 0 on PG16. A 5-second delay before CREATE INDEX reproduces it on PG17 every time. Now a gate session holds an advisory lock. Session 1 takes its snapshot, names itself, and queues for the lock. The script waits for the name, deletes, builds the index, then ends the gate. With the same delay the suite passes 28/28. A new premise in both twins says the older snapshot counted all 10000 rows, so it predates the delete. The arm still goes red when the index build skips deleted rows again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019VvWuX1zUwk6Y513waRd4N
jdatcmd
force-pushed
the
test/am-contracts-wait-for-index
branch
from
October 15, 2026 16:39
8bf3cbf to
7aa53fa
Compare
OffgridwithJD
approved these changes
Oct 15, 2026
OffgridwithJD
left a comment
Collaborator
There was a problem hiding this comment.
Re-approved at 7aa53fa, stacked on #1412.
- Same patch: this PR's own commit (e8a1af5..7aa53fa) matches what I approved at 8bf3cbf, outside the count files and ledger rows included.
- Census: 2969 / 2273 / 696 from the tsv, which matches the paragraph.
- CI: 13 checks green and 2 still running at the time of review.
🤖 Generated with Claude Code
This was referenced Oct 15, 2026
This was referenced Oct 15, 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 a timing-dependent arm in
test/am_contracts.sh, added by #1364. Test-only.The flake
The older-snapshot arm held a REPEATABLE READ snapshot, slept four seconds, and assumed the DELETE and CREATE INDEX would finish inside that window. On a loaded box they did not. The plan was taken before the index existed, and
premise: the older snapshot's lookup is an index scanread 0. This happened on PG16 during a local run of #1413, and a rerun passed. The real arm after it still passed, because a seqscan also finds the row. So the premise was the only thing standing between the arm and a vacuous pass.The fix
The steps are now ordered by events, not sleeps:
A new premise in both twins says that the older snapshot counted all 10000 rows, so it predates the delete.
Evidence (PG17 unless stated)
premise: the older snapshot's lookup is an index scan: got [0]an index built after a delete finds the row …: got [0] want [1]Ledger: one premise row, never dated (#1236): 2774 + 1 = 2775 rows, 2096 never. The gate passes against origin/main. The harness selftest passes 1245/1245 and the guard set 433/433.
🤖 Generated with Claude Code
https://claude.ai/code/session_019VvWuX1zUwk6Y513waRd4N