Repository navigation
Conversation
The reduce reads the `HEAD` of each zero-transition candidate ahead, at most one window of them. A candidate the merge never takes kept its slot: one whose blob keeps another edge, or one that already has a condemned row and settles through its own `HEAD`. After one window of such candidates no hint was admitted for the rest of the shard and every later `HEAD` ran one at a time on the round thread. On S3 a round sent 12948 of 28792 `HEAD`s that way. Blobs close in strictly ascending order within a shard, so a candidate below the current one has no later consumer. `topUpHeadHints` now discards issued hints below the current blob, skips unissued ones below it and keeps the slot of the current blob; the rest is dropped when the shard ends. The take site is unchanged. The `fold_reduce` row of `system.cas_gc_log` gains `candidate_head_reads_issued`, `_takes`, `_awaited`, `_unhinted`, `_discarded` and `_wait_us`. Tests: `CASGCReadAhead.AHintedUnreadyTakeIsAwaited` waited out a 10 s guard on every run; its read is now released after the take has read its clock, plus 50 ms. The overlap latch of the stale-candidate tests is a 5 s watchdog that a second worker ends at once. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The reduce hints three kinds of blob `HEAD`: candidates that may reach in-degree zero, pending rows before their body delete, and rows whose blob gained a reference. All three throttled on one count, `pendingHeads`. The kind that filled the window first kept the others out: a pending row that found the window full was hinted only when the fold settled it, which is a serial request the round thread waits for. On GCS 8320 of 16893 pending rows went that way in one run, and the round thread spent 605 s of a 723 s `fold_reduce` waiting for `HEAD`s. `GcReadAhead::pendingHeads(family)` counts the hinted `HEAD`s of one kind and each hinting site throttles on its own count. The requests the pool has in flight are bounded by its threads as before; the round thread can add one inline request of its own. `CASGCReadAhead.PendingRowsAreHintedWhileUnmergedCandidatesFillTheirOwnWindow` runs 80 pending rows interleaved with 80 candidates that keep an owner: 1 row is hinted at settle time, 80 with the shared count. The `fold_reduce` row of `system.cas_gc_log` gains `pending_head_reads_issued`, `_takes`, `_awaited`, `_hinted_at_settle`, `_discarded`, `_wait_us`, `intent_creates_awaited`, `intent_create_wait_us` and `head_discard_wait_us`. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
With the `HEAD` look-ahead fixed, a GC round on a store with a network round trip is bound by the GC I/O pool: in a drain of a fixed backlog the pool threads are busy in store requests in every phase. Drain of 11340 unique blobs, blobs per second of round time, at 16 / 32 / 48: S3 50 / 78 / 99, GCS 33 / 54 / 71. A backlog with shared content and two waves of removals, at 16 / 48: S3 39 / 60, GCS 26 / 52. On RustFS with fast metadata the gain is 5 to 8 %. On RustFS in its default `strict` mode, which is bound by its write rate, 16 and 48 give the same rate (68 and 69 blobs per second) and the same request errors. `PoolConfig::gc_io_concurrency` follows the setting. A test that measures request counts at a window of 16 now sets it. A server that takes the new default sends up to three times as many GC requests at once; `docs/en/antalya/cas/configuration.md` says how to keep 16. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
filimonov
force-pushed
the
work/antalya-26.8/cas-gc-orphan-sweep-premise
branch
from
December 3, 2026 18:55
1b5c936 to
8e53f78
Compare
The orphan sweep deletes a manifest of a build of epoch E only if (1) the namespace's fold cursor has consumed the seal that closes epoch E, and (2) no record above the cursor names the manifest as a removal target (`Gc/CasOrphanManifestSweep.h`). It built the namespace's protection view (a ref table recovery plus a second chain walk) before testing a listed key against either condition. When every listed build is of the fold cursor's own epoch, condition (1) refuses all of them, so the view decided nothing; on S3 it took 40 s of a 67 s phase. Test condition (1), together with the coverage and hold checks, first: they need only the sampled coverage. Build the view at the first key that passes. Condition (2) needs the view and is applied with it. A refusal before the view is a retain, so no key becomes deletable that the full premise would retain. Keys that pass go through the same view, ownership check and full premise as before. The namespace work budget is charged when a view is built: a namespace whose keys are all refused before the view takes no slot, so the next namespace gets the view in the same round. An uncatalogued namespace is charged at its first key, as before. Keys refused before the view are counted in the new `retained_before_view` phase metric, not in a `retained_*` class, since their ownership is unknown. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`precommitAdd` checked the build's epoch only at entry. A caller could pass that check, stall across a whole self-remount, and then append an `AddPrecommit` for its old-epoch manifest into the new epoch. The orphan sweep assumes a grant never crosses epochs and may already have deleted that body. Re-check the epoch inside the closure passed to `appendRefOps`. It runs in the namespace's flush, after the remount published its epoch, so a superseded build is refused there with the typed admission refusal and its precommit intent is rolled back. Signed-off-by: Mikhail Filimonov <mfilimonov@altinity.com> Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
filimonov
force-pushed
the
work/antalya-26.8/cas-gc-orphan-sweep-premise
branch
from
December 3, 2026 18:57
8e53f78 to
39af98e
Compare
This branch has not been deployed
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.
The orphan manifest sweep of a CAS GC round read a table's whole ref log before it checked whether any listed manifest could be deleted at all. On a pool that was not remounted none can, and on S3 that read was 40 s of a 67 s phase. The sweep now checks the key first. A second commit closes a gap in the writer that the sweep's safety rule depends on.
Related: #3000 (this branch is built on its head
8a212b543b62; the two commits of this change are on top)Changes
Gc/CasOrphanManifestSweep.h). Condition (1), with the coverage and hold checks, needs only data the round already has; condition (2) and the ownership check need the namespace's view (ref table recovery and tail walk). The sweep now tests condition (1) first and builds the view only when a key passes, once per namespace per page; then it runs the same ownership check and full premise as before. A refusal is a retain.gc_round_sweep_namespace_budgetis charged when a view is built. A namespace whose keys are all refused before the view takes no slot.retained_before_viewin theorphan_sweeprow ofsystem.cas_gc_log: keys refused before the view. Their ownership is unknown, so they are not counted in aretained_*class nor as retained debris in the round's summary line.PartWriteTxn::precommitAddchecked the build's epoch only at entry. A thread that passed the check and stayed descheduled for a whole self-remount could then append a precommit for its old-epoch manifest in the new epoch, after the sweep had deleted that body. The epoch is checked again inside the closure that builds the record, in the namespace's flush. A superseded build gets the typed admission refusal (retry later), and its precommit intent is rolled back.Risks / notes
retained_unconsumed_sealno longer counts unowned manifests of the chain's current epoch when they are refused before a view exists; they are inretained_before_viewtogether with live parts.fold_reduce; that is why the table below showsfold_reducegetting shorter.Testing
CAS*, release: 5536 passed. ASan + UBSan: 5534 passed, no sanitizer report. The touched files compile in the Fast test configuration.GETand no_ckptread and retains every key; a namespace budget of 1 with a first namespace refused before the view (fails before the change); an uncatalogued namespace before a catalogued one and after the budget is spent.eu-central-1), 795 parts, 10341 unique blobs, GC stopped during the load, then GC alone,cas_gc_io_concurrency48. Seconds per phase fromsystem.cas_gc_log, one run each:8a212b543b62fold_ref_intakefold_reduce, round that condemnsmanifest_deletes+ref_object_cleanupfold_reduce, round that deletespending_deletesBlobs per second of round time: 93 before, 160 after. Wall stacks of the round thread at 20 Hz: 59 % of the base's condemning
fold_reducewaits inwalkRefChaincalled from the sweep page; none after. Sweep row after:listed1000,retained_before_view1000. Two base runs of this bench differ by 2 %.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Content-addressed storage: a garbage collection round no longer re-reads a table's ref log to look for orphan manifests that it could not delete anyway. On S3 a round that condemns blobs is up to 3 times shorter. An insert whose mount was re-established under it is now refused before it writes its precommit record.
Documentation entry for user-facing changes
docs/en/antalya/cas/architecture/garbage-collection.md(retained_before_view).CI/CD Options
Exclude tests:
Regression jobs to run: