Repository navigation
pool: the expired-row job leaves a claim a wake took since it was marked - #706
Merged
Merged
Conversation
A wake between the reaper's mark and the expired-row job takes the claim, and a renew then succeeds, yet the job dropped the replica and its row: the claim ran renewed with no replica until the next replication round. The job now gives a taken claim up under the Transition lock, as the reap pause and the archive do; the next reap sees it again if nobody renews. Fixes #705
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 #705.
Defect
The reaper marks an expired claim whose row is to be dropped (an archived claim's row, or the replica of a hibernated claim that does not archive at its deadline) and queues
unrowExpired. The job checked only that it still held the claim. A wake between the mark and the job takes the claim (#696), and a client renew is then accepted; the job still dropped the replica and its registry row, so the claim ran with a renewed lease and no replica until the next replication round. For an archived claim the wake consumes the row itself and the job already did nothing.Fix
unrowExpiredreadsarchiveTakenLockedin the section that already readsheldunder the Transition lock andm.mu, and gives a taken claim up, as the reap pause and the archive do since #703. The deferred untrack still clears the mark. A claim under evacuation keeps today's behaviour (archiveTakenLockedis false for it), and the evacuation's pause archives it.If nobody renews the woken claim, its deadline stays in the past (a wake renews only a claim that archives at its deadline): the next reap marks and unrows it again, and the reap after that destroys it, as any expired claim.
Tests
TestAnExpiredRowJobLeavesAClaimAWakeTookSinceItWasMarked: a replicated claim, hibernated, its pool'sarchive_afterdropped throughSetPools, expired; the test checks it takes the replica arm, marks it as the reaper does, wakes and renews it, runs the job, and asserts the replica, its checkpoint and its unconsumed row are kept, the mark is gone, and the claim runs with the renewed lease. On main it fails: the row is consumed and the replica dropped.TestReplicaExpiryDropsTheRowThenTheClaimalready pins that a marked claim nobody took is unrowed.TestReplicaExpiryDropsTheRowThenTheClaim; replacingarchiveTakenLockedwith a plain read of the mark survives, since the two differ only for a claim under evacuation, whose end state is the same either way (the evacuation's archive replaces the replica row).Cost
One map read in a section that already holds
m.mu, in the expired-row job only. Nothing on the claim path.Prod +2 −2, tests +43.
sbx-gate.shendsGATES PASSwith 10 ×0 issues.;go test -race -count=3 -run 'Archive|Unrow|Expired|Reap' ./pool/passes.