Repository navigation
Add a configurable interval between CAS orphan manifest sweeps - #2800
Conversation
Describe the hourly interval, accepted traversal progress and bounded retries after suppression. Explain the settings and phase metrics in the operator and format documentation. Context: https://gist.github.com/filimonov/1b96ea358804b1c6e22c45380cc65469 Signed-off-by: Konstantin Morozov <[email protected]>
Cover clock boundaries, legacy state, page progress, round adoption, retry pacing and recovery. Use explicit zero intervals in fixtures that need successive orphan sweeps, including `CASWriterDuties`. Add a stateless test for the default and zero interval through manual GC rounds, with data and FSCK checks. Context: https://gist.github.com/filimonov/1b96ea358804b1c6e22c45380cc65469 Signed-off-by: Konstantin Morozov <[email protected]>
Add `cas_orphan_manifest_sweep_interval_sec` with a default of 3600. Persist traversal progress with the round state CAS and continue active pages without the interval wait. Use generation-scoped local retry pacing after committed suppression. Keep ordinary fold triggers and destructive checks unchanged. Validation: release build, 77 focused C++ tests and the scheduling stateless test through Praktika. Context: https://gist.github.com/filimonov/1b96ea358804b1c6e22c45380cc65469 Signed-off-by: Konstantin Morozov <[email protected]>
A manifest LIST failure aborts a due sweep before the round CAS. The generation stays unchanged, so every idle GC invocation forces another full fold while the failure persists. Record the adopted parent generation when page planning throws, then propagate the exception. The existing bounded fold deferral paces idle retries; changed refs and due graduations can still force a fold. Sweep progress remains tied to a successful round CAS. Strengthen the lost-CAS test with an eligible orphan and a successful control that deletes the same manifest shape. Tests: 88 focused C++ tests passed. Signed-off-by: Konstantin Morozov <[email protected]>
An unfinished traversal already has a durable `manifest_sweep_cursor`. Use it to continue the sweep and keep only the last accepted completion time in `gc/state`. This removes redundant active and start fields while preserving the hourly interval after a completed traversal. Validate the cursor and EOF transition in both directions, retain legacy state decoding, and reject overflowing decimal UInt64 strings. Update the schedule, GC, codec, and documentation tests for the single-field state. Signed-off-by: Konstantin Morozov <[email protected]>
Signed-off-by: Konstantin Morozov <[email protected]> # Conflicts: # docs/en/antalya/cas/architecture/garbage-collection.md
The initial orphan sweep now forces a fold on a fresh pool. Disable it in the deferred-round logging fixture so the test continues to prove that a deferred leader round establishes GC health and emits no completion log line. The first-fold and waiting-defer cases are covered by the orphan sweep schedule tests. Signed-off-by: Konstantin Morozov <[email protected]>
Cover the selector's precedence when a traversal is disabled or already active, and exercise retry behavior after a failed page plan. Verify that an unrelated fold or a fresh GC instance re-enables the sweep's fold requirement. Pass the sweep decision explicitly in the defer predicate tests and assert the new phase metric name. The metric assertions are expected to become green with the following naming change. Related: #2800 Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
A due sweep prevents an otherwise idle GC round from deferring, but the old `force_orphan_manifest_sweep` name suggested that it forced the sweep itself. Rename the decision and its `defer_decision` phase metric to `orphan_manifest_sweep_requires_fold`, and require callers of `shouldDeferRound` to supply it explicitly. Name the leader-local generation marker for the forced-fold suppression it records. Document how a failed page plan or a safety hold suspends that requirement for the adopted snapshot generation while other fold triggers and bounded retries remain available. Related: #2800 Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
|
🤖 [Posted by an LLM agent on behalf of @DimensionWieldr] AI audit note: This review comment was generated by AI (Grok 4.7). Audit update for PR #2800 (CAS orphan manifest sweep scheduling): Confirmed defects: Coverage summary: |
A due orphan manifest sweep forced an idle fold on every GC tick when page planning succeeded but the fold seal write or generation prune failed before the round committed. The retry marker only covered exceptions from `planManifestCursorPage`. Use a scope guard to record the adopted parent generation when fold preparation exits by exception. Disable the guard immediately before the `gc/state` commit attempt so conflicts and unknown write outcomes preserve the existing retry behavior. Name that boundary flag `gc_state_commit_started`. Add deterministic seal-write and prune failure tests that require two idle deferrals before the next fold, then verify successful recovery. Update the retry documentation. Built `unit_tests_dbms` and `clickhouse` and ran the 70 scheduling, defer and retention tests successfully. Related: #2800 Review: #2800 (comment) Co-authored-by: Codex (gpt-6.1-sol) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
|
Confirmed: seal-write or prune failures could force an idle fold on every GC tick. Fixed in 48e5e7b. |
A zero wall-clock sample near commit made `updateOrphanManifestSweepSchedule` reject a valid page with `CORRUPTED_DATA`, preventing the GC round from committing its progress. Validate the decision and cursor independently of the clock sample. Preserve the previous completion timestamp when the sample is zero, while allowing the page cursor to be adopted through the existing `gc/state` CAS. A later EOF with a positive sample records completion and restores interval pacing. Add regression coverage for intermediate pages, EOF, previous completion timestamps, clock recovery, zero interval and a conflicting state CAS. Update the scheduling documentation. Built `unit_tests_dbms` and `clickhouse` and passed all 75 scheduling, defer and retention tests. Related: #2800 Review: #2800 (comment) Co-authored-by: Codex (gpt-6.1-sol) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
|
Confirmed: a zero clock sample rejected valid orphan manifest sweep progress and prevented the GC round from committing. Fixed in 5bbe2b9. |
|
AI audit found no more defects. No CI fails are PR-caused. Full CAS checks run: https://github.com/Altinity/clickhouse-regression/actions/runs/44552771941
LGTM. |
A due or unfinished orphan manifest sweep forced an idle GC fold on every tick, bypassing the ordinary eight-round deferral. Large pools therefore performed more folds while a traversal was in progress. Use the sweep schedule only to gate page planning inside an ordinary fold. Restore the five-argument `shouldDeferRound` predicate and remove the forced-fold suppression marker, scope guard and `orphan_manifest_sweep_requires_fold` phase metric. Keep `run_orphan_manifest_sweep` as the page-eligibility metric. Exercise the ordinary cadence across initial, continuation and next traversal pages for zero and one-hour intervals. Adapt failure and clock tests to the ordinary fold conditions, remove force-specific cases and document the resulting pacing. Cursor and completion adoption retain their existing conditional `gc/state` write. Validation: built `unit_tests_dbms` and `clickhouse`, passed 83 scoped C++ tests, and passed `05428_cas_orphan_manifest_sweep_schedule` through Praktika. The new cadence test failed before the change. Related: #2800 Co-authored-by: Codex (gpt-6.1-sol) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
|
Removed sweep-driven forced folds in 9eca0a3. Sweep pages now run only during ordinary GC folds. |
Remove the obsolete orphan-manifest sweep trigger from the documented contract of `shouldDeferRound`. Sweep eligibility only gates page planning within an ordinary fold. Validation: comment-only diff; `git diff --check` passed. Build and tests were not run. Related: #2800 Co-authored-by: Codex (GPT-6) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Explain when the sweep revisits a manifest whose writer stopped before `precommitAdd`. Describe when to enable the interval setting during an upgrade and how an older GC leader can discard the last completion timestamp. Co-authored-by: Codex (gpt-6.2-astra) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
The 05428 prefix also selects the Iceberg metadata log test. Give the CAS test and its reference a distinct number so either test can be selected by prefix. Co-authored-by: Codex (gpt-6.2-astra) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Parse quoted `UInt64` fields with `tryReadIntText` and overflow checking. Reject a leading plus and trailing bytes to preserve the CAS wire format. Cover the maximum value, overflow, leading zeros and malformed inputs in `CASJsonVocab.DecimalUInt64String`. Co-authored-by: Codex (gpt-6.2-astra) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
A skipped sweep or a mismatch between the wrap flag and the cursor indicates a caller error. Report `LOGICAL_ERROR` with the decision, wrap flag, cursor emptiness and progress timestamp. Verify the diagnostics for both violations, including when the clock reads zero. Co-authored-by: Codex (gpt-6.2-astra) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Document how `now_ms_fn` timestamps a completed orphan manifest sweep and determines when the next sweep may start. The heartbeat fence-out threshold and per-round deadlines use `mono_ms_fn`. Co-authored-by: Codex (gpt-6.2-astra) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Allow the next ordinary fold to start a traversal when the saved completion time is more than one interval ahead of the leader clock. A zero clock reading preserves the wait for a known completion time with a positive interval. Cover the exact threshold, overflow, and recovery on an ordinary fold. Document how the schedule handles a future completion time. Review: https://gist.github.com/filimonov/8cdc2dd82770046cbbe84fbc271d77bf Related: #2800 Co-authored-by: Codex (gpt-6.2-sol) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Keep the generation 4 blob intent sweep on its own cursor while the manifest sweep waits for its interval. Commit both cursors and the manifest completion timestamp in the same conditional update of `gc/state`. Exercise intent progress during the manifest cooldown and retain multi-round coverage for an empty ref stream. Renumber the stateless scheduling test to 05814 because the release branch uses 05486 for blob intent requests. Related: #2917 Related: #2800 Co-authored-by: Codex (gpt-6.2-astra) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Describe the catalog recheck for a tentative manifest and the reads it adds to a planned page. Distinguish the mount-floor check from the ownership and fold-coverage checks for cataloged namespaces. Clarify how generation 4 leaders with and without the interval setting can share a pool during rollout. Co-authored-by: Codex (gpt-6.2-astra) <[email protected]> Signed-off-by: Konstantin Morozov <[email protected]>
Brings in #2800 (orphan manifest sweep schedule). No textual conflicts. Signed-off-by: Mikhail Filimonov <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
With #2800 the orphan manifest sweep runs on an interval, so the second round of the test lists four prefixes, not five. Signed-off-by: Mikhail Filimonov <[email protected]> Co-Authored-By: Claude Fable 5.2 <[email protected]>
Lower-severity notesConfigurationLow: the interval has no upper bound, so a mistyped value silently stops the sweep after the next traversal completes
Recovery latency (behaviour change, documented)Low: retries that used to happen on the next pass now wait a full interval
DocumentationLow: the README and the GC architecture docs describe a state format that never shipped
|
Each eligible GC fold previously planned a page of the orphan-manifest sweep. Planning may replay a namespace's ref log to reconstruct ownership even when every listed manifest still has an owner.
The new disk setting
cas_orphan_manifest_sweep_interval_secsets the wait between complete traversals (default 3600 seconds). A nonemptymanifest_sweep_cursorlets the next ordinary fold continue the current traversal without waiting. An interval of0allows a page on every eligible fold. Acas_manifest_sweep_list_budget_keysof0pauses the sweep and preserves its cursor.The schedule controls when a fold can list
cas/manifests/. The GC still decides whether to fold from ref-log changes, blob deletion work (pendingorstandingrows, or acandidatedue for an intent), and the ordinary deferral limit. With default thresholds an idle pool defers eight invocations before folding. An unsuppressed fold can still listblob-intents/and commit its independentintent_sweep_cursorwhile the manifest sweep waits.The round publishes the manifest cursor and the new
orphan_manifest_sweep_completed_at_msfield in the same conditional update ofgc/state. Reaching the end of the key space records completion before physical deletion. Suppression and a failed state precondition preserve the last accepted progress. Lease renewal and takeover preserve the schedule. A successful rebuild resets it. A generation 4 leader can read state written before the completion field existed. If a leader without the setting rewrites that state, the cursor survives and the completion time becomes unknown. The shared decimalUInt64reader now rejects overflow.With a known completion time, a positive interval and an empty cursor, a clock reading of zero keeps the sweep waiting. If the saved time is ahead of a positive clock reading by exactly one interval or less, the leader waits. A larger gap permits a fresh traversal on an ordinary fold. A zero reading at commit preserves the previous timestamp while accepting cursor progress.
The
defer_decisionphase metricrun_orphan_manifest_sweepreports eligibility even on deferred rounds. The post-commitorphan_sweepphase reportsorphan_manifest_sweep_page_listedandorphan_manifest_sweep_completedseparately from the number of physical deletions.Local verification at
aebec330e50f: all 879 focused C++ tests passed across 82 suites, including the empty ref-log case and blob-intent sweep progress while the manifest sweep waits. The stateless scheduling test05814passed through Praktika (1/1). Across two successive folds, only the first listed a manifest page with the default interval. Both folds listed a page with interval zero. Both configurations retained the inserted rows and reported zero dangling references.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Added the
cas_orphan_manifest_sweep_interval_secsetting to control when a new CAS orphan manifest sweep starts after the previous traversal completes.Documentation entry for user-facing changes
Updated the CAS configuration and garbage-collection architecture documentation.
CI/CD Options
Exclude tests:
Regression jobs to run: