release unique guards and version-guard the agent ttl sweep - #132
Merged
Merged
Conversation
This was referenced Sep 5, 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.
Summary
Fixes two real bugs in the agent-mode TTL sweep, and lands the design + model for on-disconnect hold reclaim (
docs/design/hold-reclaim.md).The TTL sweep deleted expired rows with a bare
batch.remove:uniquefield left its guard behind and the value became permanently unclaimable (a new create kept hitting the stale guard)The sweep now mirrors the normal delete:
expect_valueon the exact scanned bytes plusrelease_unique_guards, one batch per row so a single concurrently-renewed row no longer aborts cleanup of the rest. The pass/reap logic is factored into a smallTtlSweepCtxso the spawned task and the tests share one path.Also included: the design doc for the whole hold-reclaim effort, and
specs/AbandonedHoldReclaim.tla(+ cfgs) modeling the reap/reconnect/reclaim invariant (safe with a CAS fence + reassert-on-reconnect; false-releases without either).This is the agent half of the TTL backstop; the cluster rewire (through the replicated delete path) follows separately.
Test plan
cargo test -p mqdb-agent(new:ttl_sweep_releases_unique_guard_and_reclaims_seat,ttl_reap_skips_row_renewed_after_scan)cargo clippy --all-targets --all-features -- -D warningstlacheck:specs/AbandonedHoldReclaim.cfgsafe;_nocas.cfgand_noreassert.cfgviolateInvNoFalseRelease