Repository navigation
3.x.x: keep the PostgreSQL CI shards' database on a tmpfs, give their ledgers a 60 s statement timeout, and log slow statements - #677
Conversation
…d I/O Runs the prism-native-postgres shards on 2 vCPU (as today), on 2 vCPU with the service's data directory on tmpfs, and on 4 vCPU, and records every statement over 1 s, auto_explain plans over 3 s, CPU steal and iowait, and the database's size. Removed before the branch merges. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… ledgers a 60 s statement timeout, and log slow statements The PostgreSQL shards failed 4 of 19 CI runs on 2026-10-05 with 'canceling statement due to statement timeout' in tests their pull requests did not touch: a migration's catalog fingerprint (authorization_rpc) and a 300,000-recipient balance snapshot (candidate_window_switch), among others. On a quiet 2 vCPU runner those statements take 1 to 4 s; the failing jobs also had the slowest end-of-job disk syncs of the last 129 shard jobs, a busy host disk. - The service's data directory is a tmpfs, so commits no longer wait on the runner's disk; fsync, full_page_writes and synchronous_commit stay on, as the ledger and the fixtures require. - The job sets PRISM_DATABASE_STATEMENT_TIMEOUT_MS=60000 for the ledgers the tests open; production keeps 15 s. authorization_rpc passes it to its env-cleared child. - The service logs statements over 1 s and lock waits, which the runner prints at the end of the job. The temporary probe workflow now runs the shards under a busy disk, with the data directory on disk and on tmpfs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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. |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39b68b2b03
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Configure the service's logging in one psql call, and never fail a shard over that diagnostics step. - Say that the tmpfs covers the service only, and that spawned servers and operator tools keep the production statement timeout. - candidate_dispatch_probe restores the timeout the ledger configured instead of assuming 15 s. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Ran a high-effort code review on this branch. It made eight findings, now handled in cdc8134. Fixed:
Kept, deliberately:
The open follow-ups (children at 15 s if one of them flakes, the disposable clusters on disk, and the 1–2 s planning cost of the migration fingerprint query) will go into a tracking issue. |
…on the tmpfs service Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI_MIN_SHARES_PER_SEC's comment asks for a re-derivation when the PostgreSQL service changes. In four runs on the tmpfs service, the slowest level was 1,084, 1,056 and 1,103 shares/s in the prism-native-postgres job (runs 37369196133, 37370812752 and 37375243887), and 702 in the probe's tmpfs leg, which also loaded auto_explain. That is the range the disk runs showed, so the floor stays at 250. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The throughput floor's note claimed the tmpfs runs fell in the disk runs' range. They don't. The fourth CI run on the tmpfs (37377221495) had a slowest level of 670 shares/s, and the probe's tmpfs leg 702, both below the disk calibration's 847. The note now gives all five levels. It says 250 is about 37% of the slowest, and that it stays rather than dropping to the rule's 200. The docs and the ci.yml comment now name the one spawned process that gets the CI statement timeout: authorization_rpc forwards it to the re-run of its own test binary. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Ran a second high-effort code review, at 18c4235. It made six findings: two are fixed in 40b3561, and four are kept. Fixed:
Kept:
|
…issue Run 37379268725, at 40b3561, failed share_append_throughput_floor at 132 shares/s on the tmpfs service, so the note's "no run has come within 2.5x" no longer held. The runner itself stalled: the same job linked the test binary 2.5 to 2.9 times slower than the two runs before it, and the service log shows no slow statement or checkpoint during the measurement. The disk service had failed the same way five times between 2026-09-29 and 2026-10-01, once with almost the same levels. #683 tracks the flake. The floor stays at 250, because a floor low enough to pass such a stall would miss the collapse it exists for. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Why
The
Rust PRISM PostgreSQL and multi-instance contractsshards keep failing pull requests in tests those PRs did not touch, withcanceling statement due to statement timeout.Failure counts (CI workflow):
compact_runtime_e2e(2026-10-02): 4 of 19 runs failed on flakes, all on 2026-10-05 between 18:45 and 19:00. A fifth failure was a real regression in 3.x.x: time CTV fanout claim leases on the taker's monotonic clock, and label session timeouts and hung refreshes by the dependency they wait on (#654, #655) #667's first commit, which its next commit fixed.The four flakes:
authorization_rpc::authorization_fallback_requires_a_definitive_address_resultcandidate_window_switch::as_issued_snapshot_preparation_runs_off_the_runtime_on_both_write_pathsb275_persistence_measure::persistence_and_exact_rows_precede_three_second_stub_releaseWhat the probe showed. A probe on this branch ran all four shards on 2 vCPU, on 2 vCPU with the data directory on tmpfs, and on 4 vCPU, logging every statement over 1 s:
So the 15 s ledger timeout only breaks when the runner has a slow spell, roughly 5x or worse.
Evidence of a busy host disk in the failing jobs. The two shard-2 failures (authorization_rpc and b275) had the slowest end-of-job disk syncs of all 129 recent shard jobs: 17 s and 10 s, against a 7.4 s maximum for jobs that passed, which had more data to flush. Each shard also writes Cargo's build output (bursts up to 400 MB/s) to the same disk that holds PostgreSQL's WAL.
What
fsync,full_page_writesandsynchronous_commitstay on. The ledger refuses a server without the first two, and the fixtures check all three.PRISM_DATABASE_STATEMENT_TIMEOUT_MS=60000for the ledgers the tests open.SET statement_timeout/set_configin the fixtures,jsonb_ceiling_gate, the cutover rehearsal and migration-lifecycle extra env, and the load harness's explicit 15 s for the frontends it launches).authorization_rpcnow passes the variable to its env-cleared child, a re-run of its own test binary.candidate_dispatch_proberestores the configured timeout after its 100 ms check, instead of a literal15s.log_min_duration_statement=1s,log_lock_waits=on,log_parameter_max_length=64). The runner prints this log when the job ends, so the next statement to go slow names itself.CI_MIN_SHARES_PER_SECstays 250, as its comment asks to re-derive when the service changes.docs/prism-integration-test-gate.mddescribes the CI database.The temporary probe workflow that produced these numbers (runs 37366251758 and 37369158766) was removed in d66a8d5, so the squash-merge does not carry it.
Validation
Every CI run of the four PostgreSQL shards with this change:
qbit-prism-load --test faults(#686)share_append_throughput_floorat 132 shares/s in a runner stall (the job linked the test binary 2.9x slower than the run before; #683)Review: two
/code-review highpasses, with the outcomes in the PR comments (6002459080 and 6003867188), and Codex, which had no findings after the probe was removed.Follow-ups
share_append_throughput_floorfails when the runner stalls.Not changed
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.