Skip to content

v3.0.0 fix: bound prepared template and balance blob cleanup - #378

Merged
djh58 merged 6 commits into
3.x.xfrom
djh58/prism-b273-blob-cleanup
Sep 15, 2026
Merged

djh58 merged 6 commits into
3.x.xfrom
djh58/prism-b273-blob-cleanup

Conversation

@djh58

@djh58 djh58 commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Summary

Collect orphaned prepared-template and shared-balance blobs from the existing job pruner, including ticks that expire no jobs.

Job expiry and blob cleanup are separate phases. Expiry deletes at most 4,096 rows directly on the pool, outside the settlement/ordering advisory locks, using the existing database statement budget. After expiry succeeds, blob cleanup starts a fresh five-second deadline, acquires settlement then ordering locks, checks the writable fence, and inspects at most 256 keys per blob table.

Every remaining job and candidate reference is retained, regardless of candidate claim-lease expiry. Cursors advance only after successful blob commit. Blob failure rolls back blob changes, not already committed job expiry. Transaction-local statement timeouts preserve stricter configured settings and bound cleanup after cancellation.

Final qualification

Reviewed head: 65f0377aa475bb1844d656aa99668dc5ce14df07.

  • All 19 active CI checks passed; one optional automation check skipped.
  • Author qualification: 56 PostgreSQL integration tests and 275 unit tests passed, with two existing unit ignores; Clippy and formatting passed.
  • Independent final Fable adversarial verification found no refutation. It checked renewal re-evaluation, timeout configuration and indexed plans using disposable PostgreSQL, and explicitly inherited Rust-suite evidence from hosted CI.
  • Independent final thermo verification found no correctness defect. Its own PostgreSQL 16.15 run passed 25 compact-issued-repair tests (all 11 blob-cleanup contracts), 13 compact-prepared-storage tests, 11 candidate-window tests and two server-pruner unit tests: 51 passed.
  • The final regression verifies that a blocked expiry DELETE leaves both advisory locks available for a real share append and candidate enqueue.
  • Existing medium/Codex review findings and the original final-head history remain recorded in the review discussion. Bugbot's earlier clean review was on 72347fd; it is not represented as a fresh review of this head.

A disposable 50,000-key planner fixture confirms bounded indexed expiry/page/reference probes. This is synthetic planner evidence, not a production latency or WAL guarantee.

Explicit boundaries

Expiry failure skips that tick's blob sweep; phases are sequential, not independently scheduled. A tick can consume the existing expiry budget plus the blob budget, with no overlapping batches. Expiry still runs while a halted cluster refuses blob cleanup, preserving existing expiry behavior.

No new post-expiry grace is selected. Compact runtime activation and full refresh/resume qualification remain separate work.

Refs #273

Sweep indexed blob pages with the existing settlement then ordering locks, retain every remaining reference, and carry one deadline through PostgreSQL statements and commit. Exercise repair, candidate retention, bounded progress, and cancellation against disposable PostgreSQL.

Refs #273
@djh58

djh58 commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

@cursor review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Reuse the established fatal-state and legacy-writer fence before deleting jobs or blobs. Verify that a halted cluster preserves every row and cursor position and that the same page becomes collectible after recovery.
@djh58

djh58 commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

@cursor review

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Use a stable statement cutoff for the expiry index and a bounded array initplan for deletion by primary key. Preserve the outer expiry recheck and verify that a renewal committed during the DELETE row-lock wait retains the prepared row and its blobs.
@djh58

djh58 commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 72347fd. Configure here.

@djh58

djh58 commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

Review close-out resumed at 65f0377. Independent Fable adversarial and thermo verification are actively checking the final cleanup fix: expired-job deletion outside the share-ordering locks, a separate blob-cleanup deadline, reference retention, and rollback/cursor behavior. CI is green; final verification is pending, not claimed complete.

@djh58

djh58 commented Sep 15, 2026

Copy link
Copy Markdown
Member Author

Final coordinator review disposition — 65f0377

Both independent final lanes returned no correctness blocker. The original share-lock/expiry regression is fixed and independently verified; the thermo verifier additionally ran 51 PostgreSQL/server-pruner tests successfully on PostgreSQL 16.15. All 19 active CI checks pass and there are no unresolved inline threads.

Final non-mandatory review notes were evaluated rather than silently counted as fixes:

  • Composition/helper extraction: not adopted as a merge requirement. The production two-await sequence was independently inspected; the database contracts exercise lock-free expiry and protected blob cleanup, while server-pruner tests cover scheduling. The test helper reproduces the composition rather than calling the server closure; that test boundary is acknowledged, not claimed away.
  • Cursor Mutex / generic result type: no behavioral defect. The single sequential pruner never contends on this mutex; it supports the existing FnMut/Send closure shape. Replacing it or specializing the test result type is not needed for safety.
  • Fewer statement-timeout round trips / pre-lock page reads: optimization suggestions, not fixes to a demonstrated violation. The current page size and deadline are bounded; retain the reviewed lock/fence ordering rather than change it during close-out.
  • Capacity/mutex explanatory comments: optional documentation suggestions. The explicit 256-key/table limit is now stated in the PR summary; this is not a guaranteed throughput rate.
  • Stale PR summary: fixed here. The body now names 65f0377 and accurately describes independent committed expiry followed by a fresh blob budget; it no longer claims one five-second transaction covers both.
  • Warnings while writes are fenced, expiry failure skipping a sweep, and longer sequential tick budget: verified/documented operational behavior, not hidden failures or a new share-lock regression. Existing halted-cluster expiry behavior is preserved.

No additional code fix is requested by this close-out. Merge-ready at 65f0377. This is only the blob-retention slice; #273 remains open for compact runtime activation and end-to-end qualification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant