Skip to content

Antalya 26.8: Auto-prune expired empty fenced CAS mount slots via cas_auto_forget_fenced_empty_after_sec - #2919

Open
sks wants to merge 1 commit into
Altinity:antalya-26.8from
stackgenhq:feat/antalya-26.8/cas-auto-prune-fenced-mounts
Open

sks wants to merge 1 commit into
Altinity:antalya-26.8from
stackgenhq:feat/antalya-26.8/cas-auto-prune-fenced-mounts

Conversation

@sks

@sks sks commented Nov 18, 2026

Copy link
Copy Markdown

Problem

Deployments with ephemeral ASG/pod instances that use instance- or pod-scoped cas_server_root_id values accumulate permanent gc_fenced mount entries under gc/server-roots/<srid>/ and system.cas_mounts after scale-in or rolling replacements. Removing empty retired slots currently requires manual operator intervention.

Changes

  • Setting (ContentAddressedSettings.cpp, CasPool.h, ContentAddressedMetadataStorage.h/.cpp):
    • Added <cas_auto_forget_fenced_empty_after_sec> (default 0, disabled).
  • Empty fenced-slot pruner (CasServerRoot.h/.cpp, CasGc.cpp, ProfileEvents.cpp):
    • Recorded all_fenced_srids in HeartbeatFloor.
    • Added pruneExpiredEmptyFencedServerRoots(), called by the GC leader after heartbeat_floor when cas_auto_forget_fenced_empty_after_sec > 0 and leader authority is held.
    • A slot is pruned only when:
      1. srid != own_srid and m.gc_fenced == true,
      2. now_ms - m.expires_at_ms >= cas_auto_forget_fenced_empty_after_sec * 1000,
      3. Zero entries in cas/ref_catalog (Creating, Live, or Removing) match srid or srid + "/", and
      4. cas/manifests/<srid>/, staging/<srid>/, and roots/<srid>/ are all empty.
    • Deletes mount, epoch, and owner using exact-token op.remove (aborting safely on any Removal::Mismatch), emits a MemberDecommission (outcome = "auto_pruned") event, and increments ProfileEvents::CASGCAutoPrunedFencedMounts.
  • Tests & Docs:
    • Added CASAutoPruneFencedMounts.PrunesEmptyExpiredFencedSlotAfterThreshold and CASAutoPruneFencedMounts.SkipsFencedSlotWithCatalogNamespaceOrManifestDebris in src/Disks/tests/gtest_cas_decommission.cpp.
    • Documented cas_auto_forget_fenced_empty_after_sec in docs/en/antalya/cas/configuration.md.

Changelog category (leave one):

  • New Feature

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

Added the cas_auto_forget_fenced_empty_after_sec CAS disk setting to let the GC leader automatically prune expired, empty gc_fenced mount slots left behind by ephemeral instances.

Documentation entry for user-facing changes

  • Documentation is written: updated docs/en/antalya/cas/configuration.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)

Adds cas_auto_forget_fenced_empty_after_sec (default 0, disabled) so the CAS GC leader automatically reclaims expired gc_fenced mount slots left behind by ephemeral ASG/pod instances once they own zero catalog namespaces and zero manifest/staging/data objects.

1. ContentAddressedSettings / PoolConfig / ContentAddressedMetadataStorage: add cas_auto_forget_fenced_empty_after_sec.
2. CasServerRoot: track all_fenced_srids in HeartbeatFloor and add pruneExpiredEmptyFencedServerRoots() which verifies m.gc_fenced, expiry age >= threshold, zero entries in cas/ref_catalog, and empty cas/manifests/<srid>/, staging/<srid>/, and roots/<srid>/ prefixes before exact-token deleting mount, epoch, and owner (aborting safely on any ETag Mismatch).
3. CasGc: invoke pruneExpiredEmptyFencedServerRoots() under leader authority after heartbeat_floor when configured.
4. Add ProfileEvents::CASGCAutoPrunedFencedMounts, unit tests in gtest_cas_decommission.cpp, and docs in docs/en/antalya/cas/configuration.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: sabith <sks@stackgen.com>

This branch has not been deployed

No deployments
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