Skip to content

Stabilize CAS: fsck, GC liveness and S3 read fixes - #2941

Merged
filimonov merged 35 commits into
antalya-26.8from
feature/antalya-26.8/cas-stabilization
Nov 24, 2026
Merged

filimonov merged 35 commits into
antalya-26.8from
feature/antalya-26.8/cas-stabilization

Conversation

@filimonov

@filimonov filimonov commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Fixes for the content-addressed storage (CAS) code and for S3 reads, each story a separate commit. They remove false CORRUPTED_DATA lines from GC and cas-fsck, let GC make progress after an interrupted cold admission and let a GC round finish its ref-log intake on a remote store under steady writes, fix wrong values in system.cas_log and system.cas_mounts, make cas-fsck report progress and fail when its scan is cut short, and cut the S3 traffic of merges on wide tables.

The series is 33 commits on antalya-26.8 after the merge of #2917, plus a merge of the base that brings in #2800 and one test adjustment after it (41f7c4935be: with the sweep on a schedule a round of that test sends four LIST requests, not five).

Related: #2917
Related: ClickHouse#118483
Related: ClickHouse#124776

Changes

Commit What was seen What changes
1b0dfe53112 A merge of a table with about 2,400 columns on an uncached object-storage disk held about 2,900 sessions per Wide source part; the Disk group went above its warning limit. ReadBufferFromS3 returns the session right after a fill that completes a fixed-length body. Exact HTTPFixedLengthStreamBuf only; bounded and cut requests are unchanged.
efdb940b0ce The same merge reset about 8,100 HTTP connections: members of statistics.packed were read with open-ended GETs. Backport of ClickHouse#118483: ReadBufferFromFileView passes its right bound down. Also the 05112 part of ClickHouse#124776: the test asserts DiskConnectionsReset <= 2, so it fails without the fix. Measured on that merge: resets 8,116 to 4, bytes read from the store 9.29 GB to 28 MB, merge 36 s to 20 s, merged part identical.
44d5f2ea3a5 One full CAS* unit run left about 3,000 /tmp/cas_unit_* directories; /tmp ran out of inodes and 738 tests failed. The storage object a test helper hands out owns its directory and removes it when the last owner is destroyed. Test-only.
5a0b6fc6b7a A GC round unit test failed about once in 2,000 runs: its staging raced the snapshot publisher. Test-only: the test and the IntakePool helper publish explicitly after the drop and assert that no log entry is left above the snapshot.
d3d9d1c15c9 An interrupted cold admission left a cas/ref_catalog row in Creating forever; every GC round logged frontier INCOMPLETE and deleted nothing. The GC leader cancels the row by compare-and-swap once the creator's mount slot proves its fence terminal. New CASGCStalledCreatingCancelled; cas-fsck lists every Creating row.
0ffffdf9a49 cas-fsck online scan: GC erased a dropped table's row and the janitor deleted its _ckpt; the scan logged an error from the exception destructor. The first _ckpt read that finds nothing records a deferred unchecked verdict and builds no exception.
e0c948d3b4d cas-fsck reported blobs of an older snapshot as edges to absent manifests when a GC round committed during the scan. A stale-edge candidate is reported only if the gc/state re-read after the manifest pass still holds one of its edges; otherwise it counts in stale_edge_superseded, which is not a finding.
e375d78cb55 A GC leader that lost its lease, cas-gc-dryrun and cas-fsck logged CORRUPTED_DATA for an adopted run a newer round had already deleted. One gc/state read before raising: a moved state ends the round ABORTED; the two tools keep the absence as a refusal. An absent run under unchanged or unreadable state still raises.
8ea160884bd gc_fold_begin and gc_fold_end in system.cas_log carried the previous round's number. They carry state.round + 1, the number the round's commit writes; docs list which events carry which number.
f72f06b4d94 cas-fsck gave a blobs/ key that does not parse the identity of the empty blob. Such a key is Unaccounted with a fixed note, before any lookup or request. The shared blob key parser returns no value only for invalid syntax; other exceptions, such as a memory limit, propagate.
c5b14f9cf40 system.cas_mounts.server_uuid showed the two 64-bit halves swapped relative to the uuid file. New casServerIdToUuid parses the id with the codec it was built from. On-store bytes do not change. Stateless test 05487_cas_mounts_server_uuid.
c3edc7a7380 On a real object store cas-fsck looked hung: long phases printed nothing. Each phase that sends requests in proportion to the pool prints a start line, ticks by item count, and an end line with count, unit and seconds. The stdout summary and SYSTEM CAS FSCK are unchanged.
2e2bd21fd10 cas-gc-dryrun with a missing adopted fold seal under a live gc/state printed an empty preview and exited 0. A seal absent between two matching gc/state tokens is damage (status 1, CORRUPTED_DATA); a gc/state that moved gives a re-read. Output gains `snapshot=none
bc069526de7 After a pool migration GC needed 33 rounds and about an hour before its first complete cut; no metric showed where the time went. The fold_ref_intake row of system.cas_gc_log reports reads, takes, awaited takes, wait and apply time for ckpt, reflog and manifest, plus cursor_resolves and cursor_resolve_us. Requests and decisions are unchanged.
ca228d7e1a4 A cas-fsck scan cut by --timeout --partial exited 0, like a clean scan; the deadline message named the next phase, not the running one. It exits non-zero with TIMEOUT_EXCEEDED and still prints partial=1. Every deadline check names the phase whose progress lines are printing. Stateless test 05488.
1a7bd8566c6 The docs did not say what must not run on a pool's bucket. Docs only: expiration rules, delete-rejecting policies, cold storage classes, versioning and other writers are listed with what the server does; the rights each server needs and the trust boundary are stated.
6d1cc67d70c With gc_snapshot_generations_to_keep = 1 a round that loses its commit could prune the generation the pool still adopts and wedge the next fold. 0 is refused when the disk configuration is loaded, with a message that says what to set. 1 is loaded as 2 with a warning. To keep many generations set a large number.
c246c7f73d7 An interrupted cold admission left a Creating catalog row for as long as the creating server kept running: 4 rows after 352 failed CREATEs during store stalls. On every GC scheduler tick a writable mount cancels up to 16 of its own idle Creating rows by exact-row conditional write, then reads the pool's terminal state again, so a round does not start while SYSTEM CAS FORGET waits. New CASOwnCreatingCancelled.
7ce535b2bc3 04023_rollup_totals_memory_limit on the CAS S3 lane: a SELECT that hit MEMORY_LIMIT_EXCEEDED in the first read of a cold manifest was re-issued 53 times for about 110 s and failed with code 210. That read fails at once with its own code. A query waiting for another query's load of the same part builds the view under its own memory limit. Builds coalesce per ref and resolved manifest, never across manifests. Other reads and all writes are unchanged.
c442bb925ae A read that gave up was reported as CAS write could not be committed (read of ...). Non-write give-ups and lease refusals say CAS request did not complete (...) with the verb of the request. Code 210 and the write wording for writes are unchanged.
953d635de9d No test could stop a GC round between intake setup and the first manifest read. Test support: RoundPointForTest::AfterDiscovery fires once per folding round and changes no behavior; GetHookBackend runs a callback before a matching GET. Guards: a bucket-level 404 on a ref-log read ends the round without a delete; a leader deposed after discovery deletes no body.
2b5840211d2 On S3 a round folded about 14 ref logs/s against about 67 written and deleted nothing for 105 minutes: it proved a life's end only by reading an absent key at the end of its walk, so it chased the writers. planRefStops finds each life's first absent key by exact GETs before the first manifest read. The walk ends there and takes the bodies planning kept, counted in CASRefLogBodyGets.
54d426a1af7 The walk's read-ahead fetched every id up to the listing's last one, listed or not; pass 1 fetched records past its take budget and again in pass 2. Read-ahead hints only listed ids of the expected key's epoch, at or below the last key planning read present and at most the budget past the expected key, skipping bodies planning kept. Order, takes and decisions are unchanged.
0fcd9957ab8 The 60 s ref intake slice cut pass 2 before the walk reached its planned stops, so with fast writers every round was suppressed. The slice is 30 minutes and bounds pass 2 only. SYSTEM CAS GC STOP and SYSTEM CAS FORGET end a background intake at its next step or its final poll; the round then deletes nothing. The round logs CAS GC ref intake planned and ... progress. The CASGCLastSuccessAgeSeconds alert example moves to 2400 s.
2b94ac8a4aa GC treated every decode exception as a malformed body: a MEMORY_LIMIT_EXCEEDED on a valid log became a durable BodyUndecodable hold. Planning, the walk, resolveRefCursorSuccessor and the orphan sweep hold or retain only on isMalformedStoredRecordError. Any other error fails the operation and names the namespace and key.
fef9834806b Nothing tested a copy that lands between two lives' planning. Test-only: cells at read-ahead widths 1 and 16 assert from the request journal where the copy landed and which cut the round folded. GetHookBackend gains armAfterGet, holdGet and releaseHeldGet.
cdc5491e6fa The rights probe removed its object with a conditional delete, while GC removes intents without one: a bucket that allowed only conditional deletes passed the probe, then every GC round failed its intent cleanup. The probe sends one unconditional single-object delete.
ccc25b65b76 A hardlink kept the source part's decoded manifest and its table runtime in the transaction until publication; the runtime could not be evicted. A successful commit drops both; a failed one keeps them.
8c637908c6b cas-gc-dryrun prints the deletion intent key of each standing row, and the docs send the operator to cas-inspect with it, which refused the key with BAD_ARGUMENTS. cas-inspect prints the blob and incarnation the key names, and refuses other bytes at an intent key with CORRUPTED_DATA.
96d217db629 cas-fsck and the docs said replaced-body intents are removed "later"; the upgrade text named the wrong point of no return for 26.6.x. Docs and messages only: GC removes each intent once no part references its blob; the point of no return is M6, which raises the reader floor to 3. The GC page states what resolving a cold cursor can cost.
1a46fd2f57e On S3 (one GET about 141 ms) 8,855 of 9,233 ref-log reads of a round waited inline: the walk read ahead only ids the round's listing returned, and the listing is older than the planned stop. The walk reads ahead every id of the current epoch up to the last record planning read present. It never requests the stop, an id above that record, or another epoch. A record read ahead means what it means when read inline.
b7dd5b6ad46 CASRefContiguousAlloc.SurvivingWriterIsFencedByTheRecreatedPoolsMount failed under MSan in CI: the survivor's lease renewal could read its mount slot absent between the prefix erase and the recreated pool's claim. Test-only: the test holds the survivor's accesses to its mount key across that gap.
143dc40873a With ref logs read ahead, a round still walked about 14 ref logs/s on S3: manifests were read one at a time, 66 ms per applied log, 73 to 78 % of the 30-minute intake slice. Every round under the test load was cut and deleted nothing. After a log's own manifest requests the walk looks into ref-log bodies already fetched and requests the manifests of the next records of the same epoch, at most the read-ahead window of them. Every take, hold and counter stays at its ordered site; a repeated manifest key is read once per edge; requests made ahead are dropped when the walk of that namespace ends. CASGCReadAheadWasted also counts those.

Risks / notes

  • Shared code: 1b0dfe53112 touches src/IO/ReadBufferFromS3.cpp, src/IO/S3/ReadBufferFromGetObjectResult.* and src/IO/ReadBufferFromIStream.h; efdb940b0ce touches src/IO/ReadBufferFromFileView.cpp. Every object-storage reader is affected, not only CAS. The other commits are CAS code, tests and docs.
  • A GC round's ref intake may now run up to 30 minutes in its second pass (was 60 s). A background intake ends at the next step on a stop request.
  • Measured on real S3 (two servers, 94 tables, about 66 ref-log flushes/s, 60 minutes): before the last two GC commits every long round was cut by the intake slice and deleted nothing. With them every long round reached a complete cut and deleted (one round: 9,413 manifests and 44,032 ref-log objects at the default cas_gc_io_concurrency = 16; 18,046 and 13,568 at 48). Rounds took 764 s and 2,232 s at 16; 281 s, 854 s and 1,437 s at 48. Each round was longer than the one before and the object count was still rising when the load stopped: a steady state under this load is not shown. The intake rate grows with cas_gc_io_concurrency.
  • Planning of ref-log stops is still one namespace at a time (5 to 9 minutes for 200 namespaces on S3).
  • A manual SYSTEM CAS GC RUN is not interrupted by a stop request: SYSTEM CAS GC STOP waits until that round ends. The 30-minute slice bounds only pass 2, so a manual run on a large backlog can exceed it. If the client's receive_timeout expires first, the round continues and may delete.
  • Upgrade: gc_snapshot_generations_to_keep = 0 makes the disk refuse to load, and the diagnostic tools refuse it too. Set a large positive number before upgrading. 1 loads as 2 with a warning.
  • Not covered:
    • 1b0dfe53112 does not release sessions on bounded or cut requests.
    • d3d9d1c15c9 leaves a row from a failed cold admission on a server that keeps running until c246c7f73d7 cancels it or that server restarts.
    • 44d5f2ea3a5 leaves the directory of a re-executed death-test child that exits through std::_Exit.
  • The owner pass adds one catalog GET per scheduler tick on every writable mount.
  • On-store formats do not change.

Testing

  • The 30 commits before 1a46fd2f57e were each built and ran their own suites on a tree that differs from the branch only by files the series does not touch. The last three were built and tested together with them.
  • Head after the base merge, built with the merged sources of every file this PR or the base merge touches: CAS unit suites, release: 5188 of 5188 pass.
  • Same, ASan: 5189 pass, 2 skipped: the two memory-limit tests of gtest_cas_decode_errors.cpp, because a sanitizer build does not charge operator new to the memory tracker.
  • Stateless: 05487, 05488, 05489 and 05814 pass on the local-disk CAS lane.
  • Real S3, the measurement in the notes above; a table whose data never changes was read every 5 minutes on both servers during the load and the drain with the same result: 21 checks per stand, no mismatch.
  • Soak: two two-hour soaks with fault injection passed on earlier heads of this work. A soak on this head has not run.
  • Not verified locally: a build of the exact merge commit (the base needs a newer toolchain than the local one). CI is its first build.

Changelog category (leave one):

  • Improvement

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

CAS (content-addressed storage): garbage collection no longer stalls on a catalog row left by an interrupted cold admission, plans each ref log's stop by exact reads, reads ref logs and their manifests ahead so a round can finish its intake on a remote store under steady writes, and stops its ref intake on request. cas-fsck and cas-gc-dryrun no longer report false corruption, cas-fsck shows progress per phase and fails when its scan is cut short, and system.cas_mounts.server_uuid and the round column of fold events in system.cas_log show correct values. gc_snapshot_generations_to_keep = 0 is refused and 1 is loaded as 2. S3 reads return their connection to the pool as soon as a fixed-length body is read, and reads of a packed archive member are bounded to the member, which removes most connection resets and extra traffic in merges of wide tables.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

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)

@github-actions

github-actions Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [41f7c49]

@filimonov filimonov added the CAS label Nov 22, 2026
filimonov added a commit that referenced this pull request Nov 23, 2026
A SELECT with max_memory_usage = 1000000 hit `Query memory limit exceeded`
in the first GET of a cold part manifest. The request loop treated it as a
transport fault and re-issued the GET 53 times over about 110 s, then failed
the statement with code 210 `NETWORK_ERROR` instead of 241
(test 04023_rollup_totals_memory_limit, job "Stateless tests (arm_binary,
cas s3 storage, parallel)" of #2941).

`CasOperation::read` takes an explicit `OnMemoryLimit` mode, default
`Reissue`. The manifest GET of a cold `CachedForLoad` view build asks for
`Propagate`, and a `MEMORY_LIMIT_EXCEEDED` from that attempt escapes without
a re-issue. Every other read, every other error, the shared classifier and
all write settlement keep today's behaviour.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
filimonov and others added 23 commits November 24, 2026 00:56
A merge of a ~2,400-column table on an uncached object-storage disk held
~2,900 sessions per `Wide` source part, and the `Disk` group passed its
warning limit. `ReadBufferFromS3` now releases the session right after a fill
that completes an exact `HTTPFixedLengthStreamBuf` body; bounded and cut
requests are unchanged. `ReadBufferFromIStream` gains the accessor `sourceBuf`.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…cked archive member

`ReadBufferFromFileView` never told the buffer under it where a packed archive
member ends, so every member read on an object storage disk was an open-ended
`GET`: a merge of a 2,400-column table reset ~8,100 connections. The view now
passes its right bound down. `05112` asserts `DiskConnectionsReset <= 2`
instead of a reuse count of the shared S3 connection pool.

Upstream: ClickHouse#118483
(merge commit dc740cb)
Upstream: ClickHouse#124776
(merge commit 9e2445a), only its `05112`
part: `05110` tests ClickHouse#118480, which is not on this branch.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
One full `CAS*` run left ~3,000 `/tmp/cas_unit_*` directories; `/tmp` ran
out of inodes and 738 tests failed. The storage object a helper hands out now
owns its directory and removes it when its last owner is destroyed, also after
a failed test. Only the creating process removes it. Test-only.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`SnapshotOverAnUnreadAddAndDropTakesNoDestructiveStep` failed ~1 in 2,000
runs: a filler append raced the snapshot publisher. The test and the
`IntakePool` helper disable automatic publication, publish explicitly after
the drop and assert that no log entry is left above the snapshot. Test-only.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
An interrupted cold admission left its `cas/ref_catalog` row `Creating`
forever; every GC round then logged `frontier INCOMPLETE` and deleted nothing.
The GC leader now cancels such a row by exact compare-and-swap once the
creator's mount slot proves it terminal, and counts it in
`CASGCStalledCreatingCancelled`. `cas-fsck` lists every `Creating` row.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
An online scan could reach a dropped table's life after GC erased its row and
the janitor deleted its `_ckpt`; `chooseRecoveryGrounding` then built a
`CORRUPTED_DATA` exception whose destructor logged an error. When the walk's
first `_ckpt` read finds nothing, `walkRefStream` records a deferred
`unchecked` verdict, reported only if the confirmation cut still names the life.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A GC round that committed between the `gc/state` read and the manifest pass
made blobs of the older snapshot look like stale edges. A candidate now counts
only if the `gc/state` read after the manifest pass still holds one of its
edges, else in `stale_edge_superseded`. A GC shard refused without a run is
named `<seal key>#shard-N`, so two such shards stay two findings.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A GC leader that lost its lease, `cas-gc-dryrun` and `cas-fsck` logged a
`CORRUPTED_DATA` line for an adopted source-edge run that a newer round had
already deleted. The fold now reads `gc/state` once before raising: a moved
state ends the round `ABORTED`, and the two tools keep the absence as a
refusal. Under an unchanged or unreadable state it still raises.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`gc_fold_begin` and `gc_fold_end` in `system.cas_log` carried the previous
round's number, so `WHERE round = <Finish.round>` missed both. They now carry
`state.round + 1`, the number the round's commit writes; a later attempt
reuses it. The docs state which events carry which number.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`cas-fsck` gave a key under `blobs/` that does not parse the empty blob's
identity, so it could take that body's class and even a hard `StaleEdge`.
Such a key is now `Unaccounted` with a fixed note, before any lookup or
request. The shared blob key parser returns no value only for invalid syntax
and lets other exceptions, such as a memory limit, propagate.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`system.cas_mounts.server_uuid` showed the server UUID with its two 64-bit
halves swapped, so it never equaled `serverUUID` or the `uuid` file. The new
`casServerIdToUuid` parses the id with the codec it was built from; on-store
bytes do not change. The stateless test takes fresh pool directories and a
per-run disk name, and keeps the pool when its teardown is not confirmed.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
On a real object store `cas-fsck` looked hung: long phases printed nothing,
and progress lines called rows and refs "objects" and "pages". Every phase
that sends requests in proportion to the pool now prints a start line, ticks
by item count, and ends with its count, its unit and seconds. The stdout
summary and `SYSTEM CAS FSCK` are unchanged.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
An absent fold seal under a live `gc/state` printed no deletes and exited 0,
like a healthy empty pool. A seal absent between two matching
`gc/state` tokens is now damage (`CORRUPTED_DATA`); one absent because
`gc/state` moved is read again. The command prints `snapshot=none|adopted`,
and `test_cas_ref_snaplog` covers its exit status.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
After a pool migration GC needed 33 rounds and about an hour before its first
complete cut, and no metric showed where the time went. The `fold_ref_intake`
row of `system.cas_gc_log` now carries, for `ckpt`, `reflog` and `manifest`,
reads issued, takes, awaited takes, wait and apply time, plus
`cursor_resolves` and `cursor_resolve_us`. Decisions and requests are unchanged.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A `--partial` scan cut by its deadline exited 0 like a clean scan; it now
fails with `TIMEOUT_EXCEEDED` after finding-specific errors and still prints
`partial=1`. The deadline message named the next phase, not the running one;
every deadline check now names the phase its progress lines print. `05488`
scans a copy of the pool taken from `mktemp -d`.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The bucket requirements page said what a bucket must support, but not what
must not run on it: expiration rules, delete-rejecting policies, cold storage
classes, versioning, other writers. It now lists them with what the server
does, and states the rights each server needs and that the bucket's write
credential is the pool's trust boundary. Docs only.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
With 1, a round that loses its commit can prune the generation the pool still
adopts and wedge the next fold. 0 is refused with a message that says what to
set; 1 loads as 2 with a warning, and the prune treats a `PoolConfig` value of
1 as 2.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
352 failed `CREATE`s during store stalls left 4 `Creating` rows that no leader
may cancel while their server runs; they kept destructive GC suppressed on an
emptied pool. Each GC scheduler tick a writable mount now cancels up to 16 of
its own idle `Creating` rows, then reads the pool's terminal state again, and
counts each cancel in `CASOwnCreatingCancelled`.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`04023_rollup_totals_memory_limit` on the CAS S3 lane: a `MEMORY_LIMIT_EXCEEDED`
in the first `GET` of a cold manifest was re-issued 53 times for ~110 s and
failed with 210. That read now fails at once. A query waiting on a build that
failed on another query's memory limit builds the view itself, and builds
coalesce per ref and resolved manifest, never across manifests.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A read that gave up said `CAS write could not be committed (read of ...)`.
Non-write give-ups and lease refusals now say `CAS request did not complete
(...)` with the verb of the request; code 210 and the write wording stay.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`RoundPointForTest::AfterDiscovery` fires once per folding round, after the
intake setup and before the first manifest read; it changes no behaviour.
Guards that pass on this tree: a bucket-level 404 on a ref-log read ends the
round without a delete, and a leader deposed after discovery deletes no body.
`GetHookBackend` runs a callback once before a matching `GET` is served.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A round proved a life's end only by reading an absent key at the end of its
walk, so it chased writers: on S3 it folded ~14 ref logs/s against ~67 written
and deleted nothing for 105 minutes. `planRefStops` now finds each life's
first absent key by exact `GET`s before the first manifest read; the walk ends
there and takes the bodies planning kept, counted in `CASRefLogBodyGets`.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The walk's read-ahead fetched every id up to the listing's last one, listed or
not, and pass 1 fetched records past its take budget and again in pass 2. It
now hints only listed ids of the expected key's epoch, at or below the last
key planning read present and at most the budget past the expected key,
skipping bodies planning kept. Order, takes and decisions are unchanged.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
filimonov and others added 7 commits November 24, 2026 00:56
The 60 s slice cut pass 2 before the walk reached its planned stops, so with
fast writers every round was suppressed. The slice is now 30 minutes. A stop
request ends a background intake at its next step or its final poll, and the
round deletes nothing. The round logs `CAS GC ref intake planned` and
`... progress`; the `CASGCLastSuccessAgeSeconds` alert moves to 2400 s.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
GC treated every decode exception as a malformed body: a `MEMORY_LIMIT_EXCEEDED`
on a valid log became a durable `BodyUndecodable` hold. Planning, the walk,
`resolveRefCursorSuccessor` and the orphan sweep now hold or retain only on
`isMalformedStoredRecordError`; any other error fails the operation and names
the namespace and key.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A copy that lands between two lives' planning must keep every body a writer
names. Each cell asserts from the request journal where the copy landed, that
the read-ahead is in flight at its event, and which cut the round folded;
width 16 runs two schedules. `GetHookBackend` gains `armAfterGet`, `holdGet`
and `releaseHeldGet`. Test-only.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The rights probe removed its object with a conditional delete, while GC
removes intents without one: a bucket that allowed only conditional deletes
passed the probe, then every GC round failed its intent cleanup. The probe now
sends one unconditional single-object delete; tests that count deletes take
their baseline after the open.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A hardlink kept the source part's decoded manifest and its table runtime in
the transaction until publication. A mutated part's projections share it for
the part's whole life, so both stayed in memory and the runtime could not be
evicted. A successful commit now drops them; a failed one keeps them.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`cas-gc-dryrun` prints the deletion intent of each standing row and the docs
send the operator to `cas-inspect` with it, which refused the key with
`BAD_ARGUMENTS`. `cas-inspect` now prints the blob and incarnation the key
names, and refuses other bytes at an intent key with `CORRUPTED_DATA`.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`cas-fsck` and the docs said replaced-body intents go "later"; GC removes each
once no part references its blob. The upgrade text named the tool's last write
as the point of no return for 26.6.x; it is M6, which raises the reader floor
to 3. The GC page now says what resolving a cold cursor can cost and that
read-ahead metrics match across widths only for the same completed work.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
@filimonov
filimonov force-pushed the feature/antalya-26.8/cas-stabilization branch from 528db6e to 96d217d Compare November 24, 2026 06:12
filimonov and others added 5 commits November 24, 2026 13:08
The walk hinted only ref-log ids the round's listing returned. The
listing is taken when the round starts, so records written while
planning ran were below the planned stop but unlisted and were read
one at a time: on S3 8,855 of 9,233 ref-log reads of a round waited
inline, 141 ms each.

`topUpLookahead` now hints every id of the current epoch above the
expected one and at or below the last sequence planning read present
there, within the existing distance bound. It never hints the stop, an
id above that record, or another epoch. A hinted record that is absent,
malformed or failed means what it means when read inline, and is
dropped if the walk does not reach it.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ce test

`SurvivingWriterIsFencedByTheRecreatedPoolsMount` expects the renewal to
see a foreign occupant. A renewal landing between the prefix erase and
the recreated pool's claim reads the slot as absent, is classified
`vanished` and does not bump `CASMountReleaseSkippedForeignOccupant`, so
the counter assertion failed intermittently under MSan.

Gate non-test access to the mount slot until the recreated pool has
claimed it.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Each ref log's manifests were requested only when that log was decoded
and were taken before the next log, so a run of single-edge logs read
its manifests one at a time. On S3 that was 66 ms per applied log and
73 to 78 % of a 30-minute intake slice; a round under about 66 ref-log
flushes per second never reached a complete cut.

After the current log's own hints the walk now looks into ref-log
bodies that are already here (kept by planning, or read ahead and
present) for the next records of the same epoch and hints their
manifests, at most the read-ahead window of them and no further than
the walk may still take. It stops before a seal or a terminal record.
Every take, decode, hold and counter stays at its ordered site; a
repeated manifest key is observed once per edge; everything hinted
ahead is discarded when the visit ends.

`GcReadAhead::peekRead` and `RetainedRefBodies::find` borrow a body
without taking it. `CASGCReadAheadWasted` now also counts reads a walk
drops at a hold, the end of its slice or a stop request.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[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]>

@k-morozov k-morozov left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I reviewed how GC walks the ref log during concurrent writes. This PR fixes the unbounded walk by setting a stopping point for each life_id before replay. We should evaluate whether a full LIST on Amazon S3 can provide that boundary without extra probes. If probes are still needed, we should explore running them in parallel across life_ids.

@filimonov
filimonov merged commit 5d40385 into antalya-26.8 Nov 24, 2026
608 of 619 checks passed
@DimensionWieldr DimensionWieldr added the verified Approved for release label Nov 24, 2026
@DimensionWieldr

Copy link
Copy Markdown
Collaborator

AI audit found no defects.

No CI failures are PR-caused.

  • Unit tests (msan) are timing out. Not stuck, just taking longer than the current 90 minute timeout allows. This needs to be increased in ci/jobs/unit_tests_job.py.

CAS checks: https://github.com/Altinity/clickhouse-regression/actions/runs/45420269401/job/138537627594

  • No fails are PR-related

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.

5 participants