Repository navigation
Date a GC mount-token sighting after the read that returned it - #2509
Conversation
The GC credited the first sighting of a mount token with a clock sample taken before the LIST of gc/server-roots/ and the slot read. A slow walk then counted as time the token was watched, and a later round could write gc_fenced over a holder whose last renewal still gave it authority. Both callers of computeHeartbeatFloor (the regular round and the rebuild) now pass the observer clock as a function; the sighting is sampled after the read, including the re-decision after a refused fence-out. The stability test keeps its entry sample, and a sample older than the sighting never counts as time held, so the elapsed time cannot wrap. Closes backlog task CAS-342. Related: #2431 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
PR #2509 Distributed-Systems Audit
SummaryNo confirmed distributed-systems defects in the reviewed scope. The fence is safe only if the GC fences no earlier than one observation threshold after the holder's last renewal was written. Before this PR, the first sighting of a token was dated with a clock sample taken at round entry, before the Model assumptions
Evidence
Notes (not defects)
Coverage summary
LimitsStatic review of head |
PR #2509 CI Verification
VerdictNone of the failures is caused by this PR. Of 5 failing checks, 3 are pre-existing failures, 1 is a cascade of one of them, and 2 are Grype image scans, which are not tests. Coverage gap: the CAS regression suite did not run. The CAS checkbox was ticked after CI started, so Failures
What this PR's own tests show
RecommendationApproval is not blocked by any failure. Before relying on the fix, run the CAS regression suite on |
The GC credited the first sighting of a mount token with a clock sample taken before the
LISTofgc/server-roots/and the slot read. A slow walk to the slot counted as time the token had been watched, and a later round could writegc_fencedover a holder whose last renewal still gave it authority. The sighting is now dated after the read that returned the token.Why it matters for the lease
The GC on another server is the observer that decides a writer is dead: it waits until the slot token has stayed unchanged for
cas_mount_lease_ttl_ms + 5 % + its own poll stepon its own clock (about 41.5 s with the defaults), then setsgc_fencedand drops the protection of that writer's unfinished work. It never compares clocks across servers; the only thing that makes the decision safe is that the wait starts when the observer actually saw the token. Starting it earlier shortens the window below the lease, so a holder that still has authority can be fenced: a ref-log append that lands after such a fence leaves a reference to blobs the GC may delete.This becomes reachable with the next change of the series (#2431): the background renewal will keep retrying through a storage outage instead of fencing itself after 4 s, so a live holder will routinely spend tens of seconds without changing its token. Roll this change out on GC nodes before that one reaches the holders.
Changes
computeHeartbeatFloortakes the observer clock as a function; both callers (the regular round and the rebuild) pass it. The first sighting is sampled after the read; the re-decision after a refused fence-out dates its observation anew.MountIncarnationObservation::heldFor), so the elapsed time cannot wrap.Risks / notes
Gcwith an empty observation map); the fix there keeps both callers consistent.Testing
CaMountObserveCorerowssab_sighting_before_readandsab_redecision_stale_sampleshow the fence inside authority without the fix;mainis green with it.gtest_cas_mount.cpp,gtest_cas_gc_ack_floor.cpp: round and rebuild), two behaviour-preservation tests;CAS*gate 2615 (release), 2619 (ASan, no error).Closes backlog task CAS-342.
Related: #2431
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
CAS GC no longer fences a mount whose token it watched for less than the observation threshold after a slow walk to the slot: the first sighting is dated after the read that returned the token.
Documentation entry for user-facing changes
CI/CD Options
Exclude tests:
Regression jobs to run: