Repository navigation
pool: an archive job leaves a claim a wake took since it was marked - #703
Merged
Merged
Conversation
A reap or sweep job marked a claim and later archived it after checking only its shape. A wake in between gave a lapsed claim a fresh lease, and since #696 a renew while its VM was up could set a new deadline and expiry action; a second hibernate before the job's first look let the job archive it anyway and overwrite the lease with the retention deadline. The taken mark records those client changes under a mark (a wake's lease, a renew's deadline and on_expire), so pauseArchive and archive() now give up a claim whose mark is taken, except one the node is evacuating, which is archived whatever its lease as before. Operator changes after the mark (archive_after set to 0, a tenant removed, replication switched) are not covered, as on main. Fixes #698
This was referenced Dec 3, 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.
Fixes #698.
What was wrong
A reap or sweep job marks a claim and later archives it, and between the two it checked only the claim's shape. A wake in between gives a lapsed claim a fresh lease, and since #696 a renew while that woken claim's VM is up can set a new deadline and expiry action. If the claim was hibernated again before the job's first look, the job archived it anyway and overwrote the lease with the retention deadline. Three doors, one shape: the reaper's pause-then-archive of a running claim, the reaper's archive of a hibernated one, and the idle archive sweep.
The change
Under a mark, a client can change a claim's lease or expiry action only through a taker: the wake renews it, and a renew is accepted only for a claim a taker took (#696). So the taken mark is the signal, and no deadline is re-read:
pauseArchive, before its hibernate, andarchive(), where it reads the snapshot under the Transition lock, give up a claim whose mark is taken (errWokeMeanwhile, the same exit as a wake during the export; the next sweep decides again).One exception: a claim the node is evacuating is archived whatever its mark, as before. An evacuation drops a claim from its run on any error. Wakes and resizes are refused for an evacuating claim at admission, so a taken mark can appear there only from a wake already past admission or from the restart of a failed claim, which skips that check.
Unchanged: the check after the export (a wake during the export is caught by the snapshot), and a resize undone during the export (same snapshot, nothing renewed; the export archives the claim).
Kept: between a taken claim's second hibernate and the job's give-up, a renew or a move of that claim is still refused as archiving (409; a wake clears it). Lifting that would let a resize undone during an export archive over a renew that was granted.
Not covered, as on main: operator changes after the mark (
archive_afterset to 0, a tenant removed, replication switched).Production +9 −3, tests +88 −55.
Tests
Two tests from #696 staged exactly these doors and asserted the old outcome (the job archives; a renew during its export is refused). The outcome changes by design, so they are rewritten:
Both rewritten tests fail on main (the job returns nil and the deadline is the retention deadline). Mutants, each killed by a named test: the helper always false, the helper without the evacuating term, each of its two uses removed, and #696's old rule.
Hot path
Nothing on the claim path.
pauseArchive: one map read in a section that already holdsm.mu.archive(): onem.mulock and one map read per archive job.A job that gives up sets the claim's archive retry time one minute ahead, as a wake during the export already does.
Not covered on hardware
The doors need a wake and a hibernate between a sweep's mark and its job; on a host that is a race with no lever. The tests stage the order directly.
Gates
sbx-gate.sh(lint, fmt-check, asl, tests with-race, both GOOS) endsGATES PASSon this head, which sits on main.