Compact receipt-backed completions#352
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
adfb235 to
d435706
Compare
Code Review — Compact receipt-backed completionsReviewed against base VerdictNeeds rework — not mergeable yet. The design is structurally sound: the BlockersB1 — Claim idempotency battery never consults
|
Summary
This PR changes the queue-storage successful receipt completion path from one terminal row per job to compact append-only receipt completion batches. Successful short-job completions now write:
lease_claim_closuresrow per claim for durable close evidencereceipt_completion_batchesrow per completion batchdone_entriesrows on the successful receipt fast pathThe
terminal_jobsview expands compact batches through retainedready_entries, and SQL compatibility deletes writereceipt_completion_tombstonesinstead of mutating the batch rows. Queue prune now truncates the matching receipt batch/tombstone and terminal-delta children with the ready/done children.The PR also tightens the claim path after the first benchmark pass exposed a planner problem. The earlier head-evidence query could be planned as hashed subplans over retained receipt/ready history. This version uses short-circuited PL/pgSQL point probes for the head row, avoiding the retained-history scan while preserving the lost post-commit cursor-advance recovery path.
Validation
Local checks run:
cargo fmt --all -- --checkgit diff --checkcargo check --workspace --all-targetsDATABASE_URL=postgres://postgres:test@localhost:15432/awa_test cargo test --package awa --test queue_storage_runtime_test -- --nocapture(101 passed)DATABASE_URL=postgres://postgres:test@localhost:15432/awa_test cargo test --package awa --test migration_test -- --nocapture(43 passed)./correctness/run-tlc.sh storage/AwaSegmentedStorage.tla./correctness/run-tlc.sh storage/AwaSegmentedStorage.tla storage/AwaSegmentedStorageInterleavings.cfg./correctness/run-tlc.sh storage/AwaDeadTupleContract.tla./correctness/run-tlc.sh storage/AwaStorageLockOrder.tla./correctness/run-tlc.sh storage/AwaStorageTransition.tla./correctness/run-tlc.sh storage/AwaShardedPrune.tlaNo shared-library files are tracked by git.
Smoke Benchmarks
Short local 5k/s offered-load smokes used the benchmarking repo against this dirty Awa checkout before commit. Postgres was the harness default
postgres:18.3-alpinewith the default 4 CPU container limit.custom-20260614T045536Z-40edc6custom-20260614T045924Z-1a396fcustom-20260614T050110Z-454f38The 128-worker run is the first clean local 5k/s evidence for the compact path. It used zero
done_entries; successful terminal state came throughreceipt_completion_batches. The named residual mechanism is permit-granularity claim amortization: with one claimer, the dispatcher only claims as many worker permits as have freed when it wakes. At 64 workers that averaged ~32 jobs per claim call; at 128 workers it averaged ~64 and reached the offered load. Extra claimers helped only modestly and introduced more empty claim calls / relation-lock samples.I also pushed a benchmark harness descriptor fix in
hardbyte/postgresql-job-queue-benchmarking(f082bfc) so future runs trackreceipt_completion_batches_*,receipt_completion_tombstones_*, andqueue_terminal_count_deltas_*dead tuples directly.