Skip to content

Accept only a strictly greater epoch when claiming a CAS mount slot - #2512

Merged
filimonov merged 1 commit into
antalya-26.6-20261008from
fix/antalya-26.6/cas-mount-claim-monotonicity
Oct 12, 2026
Merged

filimonov merged 1 commit into
antalya-26.6-20261008from
fix/antalya-26.6/cas-mount-claim-monotonicity

Conversation

@filimonov

@filimonov filimonov commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

A claim of the CAS mount slot now writes only above the slot's writer_epoch. Three paths of claimMount could leave two live incarnations under one epoch or put an older incarnation over a newer one; both break the rule recovery relies on — it seals only the epochs below the live one — so a write made under such an incarnation would never be sealed out.

Why it matters for the lease

Each claim of the slot by the same server_uuid takes a fresh writer_epoch from the epoch counter; GC fencing, farewell and recovery all speak in terms of "incarnation N is closed". The lease rework that follows (#2431) lets a server continue after its own gc_fenced pause by closing the old epoch and claiming a strictly greater one; that is only sound when no path can hand two processes the same epoch or let a stale allocation win.

Changes

  • Own server_uuid with a newer epoch in the slot: throw ABORTED without a write (cas_log event newer_epoch). An older allocation that reaches the slot late never replaces the newer incarnation, whatever certifies its end.
  • Own (uuid, epoch) in the slot: never rewritten. The "refresh" branch is gone — our pair in the slot before we wrote anything means another process was allocated our epoch. gc_fenced → FencedSelf; otherwise LiveDoubleStart with the holder's body, and the caller takes a fresh epoch.
  • A raced write that observes a newer own epoch fails at once instead of waiting for a death certificate that cannot come.
  • next_writer_epoch = 0 (the encoding's absence value) is rejected when the counter is decoded.
  • Own uuid with an older epoch: unchanged — reclaim only on a certificate of death.

Risks / notes

  • Nothing changes on the store or in the wire protocol. The refresh branch fired only on a double start or a race with a decommission; those now get an explicit error instead of silent shared ownership.
  • Model: CaCasMountCore is green; sab_equal_epoch_refresh (refresh restored) yields two live incarnations under one epoch, sab_stale_claim_replaces_newer yields an unsealed write.

Testing

  • Five regression tests red on the base (gtest_cas_mount.cpp, gtest_cas_mount_claim_conflicts.cpp, gtest_cas_server_root_format.cpp): own pair → LiveDoubleStart with no write; newer own epoch → ABORTED; zero counter rejected; raced newer epoch fails at once; fenced own pair → FencedSelf. Three behaviour-preservation tests.
  • CAS* gate: 2615 (release), 2619 (ASan, no error).

Closes backlog task CAS-298 (the claim part).
Related: #2431

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

A CAS mount claim accepts only a strictly greater writer_epoch: it no longer refreshes its own pair in the slot or replaces a newer incarnation of the same server, and a zero epoch counter is rejected.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Updated docs/en/antalya/cas/architecture/mounts-and-leases.md.

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Unit tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • CAS (content-addressed storage; Antalya only)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

Recovery seals only the epochs below the live one, so the slot must
always hold the newest incarnation of a server_uuid and nothing older
may be written under that uuid. claimMount broke this in three places:
finding its own (uuid, epoch) in the slot it "refreshed" the body, which
let a second process share the incarnation that another process had
been allocated; an older allocation that reached the slot after a newer
epoch could wait for a death certificate and replace it, and that write
would never be sealed; and a next_writer_epoch of 0 (the encoding's
absence value) was accepted when the counter was decoded.

A claim now writes only above the slot's epoch: a newer own epoch in the
slot throws ABORTED without a write; the own pair in the slot is never
rewritten (gc_fenced → FencedSelf, otherwise LiveDoubleStart with the
holder's body, and the caller takes a fresh epoch); a raced write that
meets a newer own epoch fails at once instead of waiting for a
certificate that cannot come; a zero next_writer_epoch is rejected.
Nothing changes on the store.

Closes backlog task CAS-298 (the claim part).

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.1 <[email protected]>
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [17c7f28]

@filimonov
filimonov force-pushed the fix/antalya-26.6/cas-mount-claim-monotonicity branch from 88953e6 to 17c7f28 Compare October 8, 2026 12:03
@k-morozov
k-morozov self-requested a review October 9, 2026 16:33
@filimonov
filimonov merged commit 2a034cd into antalya-26.6-20261008 Oct 12, 2026
301 of 316 checks passed
@k-morozov k-morozov added the verified Approved for release label Oct 20, 2026
@filimonov

Copy link
Copy Markdown
Member Author

Ported to antalya-26.8 in #2805 (commit bb13294). Clean cherry-pick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants