Repository navigation
fix(maintenance): hold a timed-out purge instead of detaching it (#1103) - #1247
Conversation
…tarting another A purge that outlived its cap was detached, not stopped: the pass returned, the loop cleared its running flag, and every later tick spawned another purge, so a store slower than the interval piled up purges against the same database. The worker now holds the timed-out purge's handle. The next pass waits on it again, with the same cap, instead of starting a second one, and reports its counts if it finishes then. A purge that finishes between passes has its result logged, and only then does a pass start a new one. A purge that never returns now holds retention until it does or the relay restarts; each pass that waits on it logs how many passes it has waited. The loop logs each pass's outcome. Closes #1103 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, and test the late arm From review on #1103: - store_outstanding_purge no longer overwrites a held purge; an overlap is a debug_assert and, in release, an error log rather than a silent detach - a test reaches the arm that reads a purge which finished between passes and starts a new one - ADR 0019 D1/D3 no longer say the loop discards the outcome; D1 records the two new PassOutcome fields - purge_started is set at each arm rather than derived from the counter - the run_pass doc names what a cancelled or overlapping pass does - the still-running warning fires on the first wait and every tenth Refs #1103 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
🦋 Changeset detectedLatest commit: cd0bfd8 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
[Medium impact] The PR appears safe to merge; the previous finding is addressed and no new actionable issues were found.
|
… be silenced The late-purge case asserted only that a fresh purge started; deleting log_late_purge(previous.handle.await) left every assertion passing. Capture the formatted log through a subscriber installed in the test binary and assert the line and its counts. Removing the call now fails the test (9 passed, 1 failed), which the previous version did not.
Description
Lands the fix for #1103. The first two commits are AgrimTawani's, exactly as written on their
fork (
6269d9eonc75a92c); the third is mine and touches only the test file, because thelate-result test could not fail — deleting
log_late_purge(previous.handle.await)left everyassertion passing. It now captures the log line and asserts the counts on it; with the call
removed the test reports 9 passed, 1 failed.
Both of the author's commits keep their authorship: the repository allows merge commits only
(squash and rebase are off).
A retention purge that outlived the pass's 5 s cap used to be detached rather than stopped: the pass
returned, the loop cleared its running flag, and the next tick started another purge. The worker now
holds the timed-out purge, the next pass waits on it again with the same cap instead of starting a
second one, and reports its counts if it finishes then. A purge that finishes between passes has its
result logged rather than lost. An overlapping pass can no longer overwrite a held purge.
Related Issue
Closes #1103.
Motivation and Context
A store whose cleanup is slower than the maintenance interval accumulated purges competing for the
same database. Aborting a store write midway was rejected: a purge that never returns now holds
retention until it does or the relay restarts, which is stated in the module doc, the ADR and the
changeset rather than left implicit.
How Has This Been Tested?
cargo test -p nostream-services --test maintenance— 10 passed, the target 10 more times back toback with no failures, and the late-log assertion proved by deleting the call it names
cargo test --workspace --all-features— 1820 passed, 0 failedcargo fmt --all --checkandcargo clippy --workspace --all-targets --all-features -- -D warnings— clean
rewrite/main6d1454b1; feat(mcp): the maintenance tools, the counts the pass drops, and the run record #1226 does not touch these filesTypes of changes
Checklist