Skip to content

CAS: replace blob markers with deletion intents (format generation 4) - #2917

Merged
filimonov merged 47 commits into
antalya-26.8from
feature/antalya-26.8/cas-blob-deletion-intents
Nov 23, 2026
Merged

filimonov merged 47 commits into
antalya-26.8from
feature/antalya-26.8/cas-blob-deletion-intents

Conversation

@filimonov

@filimonov filimonov commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

CAS (content-addressed storage) drops the per-blob .meta marker. GC records its decision to delete a blob body in a deletion intent: an immutable object under blob-intents/, keyed by the blob and the exact incarnation of its body. A first INSERT of new data needs half the PUT requests, and GC leaves no marker behind. The change also fixes a data loss in GC that the marker protocol has too (see "Data loss fixed").

Draft. Commits 1 to 10 are the protocol; commit 8 is the switch. Commits 11 to 33 are fixes and follow-ups, one theme each; every one of them is a tree that was built and tested as a whole. The last commit merges antalya-26.8 (one conflict, in a docs file); that merged tree was not built locally.

Data loss fixed

  • What happened. A part copied into another table without reading its data (ATTACH PARTITION FROM, REPLACE PARTITION, MOVE PARTITION TO TABLE, a mutation that hardlinks unchanged columns, RENAME TABLE in an Ordinary database), followed by a drop of the source, could lose blob bodies. A GC round counts references table by table. If it read the destination table before the copy and the source table after the drop, it saw zero references for a blob that a committed part names, and deleted the body.
  • Which versions. The defect is older than this change. antalya-26.6 has it with the marker protocol: there it needs two such hand-overs in a row (shown by a model, not reproduced on that code). It is not fixed on antalya-26.6; upgrade to get the fix.
  • The fix. GC does not delete a body in a round that saw any reference change for that blob. A round re-reads gc/state before anything destructive and stops if it is no longer the leader's state (a paused leader that woke up after another leader cleaned the logs could also delete a live body). Copies confirm that their source is still current after the destination is recorded. The GC baseline rebuild refuses when it cannot count the references of an unfinished write.
  • Found on the way and fixed: a part rename could delete a destination that another rename had committed; a migration could raise the pool format over a GC state the new GC rejects; a GC round trusted a seal summary that disagreed with its rows; a staged file moved to another part left a hardlink with no upload behind it.

Changes: the protocol (commits 1 to 10)

  • Writer. It records its reference, then sends HEAD of the body. Absent: upload. Present: GET of the intent for that incarnation; absent means reuse the body, present means upload a fresh incarnation. A writer never writes or removes an intent.
  • GC. A row goes candidate, pending, standing, decided by the pure function decideIntentStep. One round creates and confirms the intent, a later round deletes the body with a conditional delete, a later round removes the intent. A row is dropped when a reference appears. A round with an incomplete reference cut deletes nothing.
  • Intent creates run concurrently inside a round (gc_io_concurrency). gc_round_intent_create_budget (default 0, unbounded) caps them per round.
  • Format generation 4. New pools are created at generation 4. A pool of an older generation is refused at open.
  • clickhouse-disks cas-migrate-pool converts an older pool once, offline, including pools written by the 26.6 line.
  • cas-fsck knows the intent classes, reports a pending row without its intent, and treats legacy markers as debris (--fix legacy-markers).
  • Store probe. A writable open proves the rights it needs under blob-intents/ and reports the missing one.
  • Every streamed blob is hashed before its object completes; a payload that does not match its name is refused.
  • Unrelated fix, commit 1. A GC round failed every time over a staged manifest of a table whose ref log was still empty (LOGICAL_ERROR from renderRefTxnId on a zero cursor). The same code is on antalya-26.6.

Changes: fixes and follow-ups (commits 11 to 33)

  • An intent left by a spared blob is deleted at once when the body it names is gone or replaced. Without it intents piled up: about 100 per minute in a 2-hour soak.
  • GC: the rule on a touched zero; the check of the leased gc/state (reason parent_unconfirmed in system.content_addressed_gc_log); a deposed leader's round ends as ABORTED, not CORRUPTED_DATA; the delete budget rotates, so one stuck row cannot starve the rest; one reader checks every inherited GC run (shard, order, round, summary) for the GC, the migration, cas-fsck and the dry run.
  • Copies: createHardLink and the part rename confirm their source after the destination is recorded and before it is committed, on a pinned table with one deadline; an unconfirmed source fails the statement with NO_REPLICA_HAS_PART and a message that says to run it again; a rename never deletes a committed destination.
  • Tools: cas-migrate-pool validates the GC state it adopts and probes blob-intents/ rights before its first irreversible step; cas-fsck and cas-gc-dryrun re-read a GC snapshot that moved under them; cas-fsck --concurrency; a deadline ends a scan as a timeout, not as findings.
  • Store tokens cannot be compared with ==: two named comparisons, one for a blob's identity and one for a control object's version.
  • Tests: a hook inside the GC round and a matrix of 1,012 copy-and-drop schedules (CASInterleave); without the GC rule 30 cells lose a body, without the source confirmation 56 do. An integration suite runs the SQL copies under running GC rounds.

One INSERT ... SELECT into a 109-column table: 340 Wide parts, 60,008 blobs. Local RustFS, measured on the tree of commit 35. After: median of 3. Before (0aa837e942e): one run on the same day.

Before After
First insert, s 436.7 274.8
First insert, PUT 121,376 61,368
Second identical insert, s 59.6 62.8 (ranges overlap)
Peak memory, MiB 3,132 2,982
ATTACH PARTITION ALL FROM, 340 parts, s 23.5 24.3 (one extra GET per part)

A new blob costs one PUT less, so a first insert is about 37 % faster. Reuse costs the same. An earlier series measured 503.1 s and 16 to 44 leaked markers on the base; the rerun gave 436.7 s and no leaked marker, so those two figures are not claimed.

Also in this pull request (commits 35 to 46)

Risks / notes

  • The on-store format changes and there is no way back. A generation-4 pool cannot be opened by older builds, and this build refuses older pools. Stop every server of the pool, run cas-migrate-pool, then start this build. Steps: docs/en/antalya/cas/operations/migration.md.
  • New bucket rights. Conditional PUT, GET, LIST and DELETE under blob-intents/: docs/en/antalya/cas/bucket-requirements.md.
  • No repair for a corrupt GC state on a pool where GC has run. SYSTEM CAS GC REBUILD and clickhouse-disks cas-gc-rebuild refuse with another GC leader holds the lease on such a pool; this is older than the change and is shown by a test here. GC then stops reclaiming on that pool; stored data is not affected. The fix is a follow-up.
  • Monitoring names. SYSTEM CAS GC RUN and system.content_addressed_gc_log keep the old column names next to the new ones (entries_intent_confirmed, entries_bodies_deleted, entries_body_delete_failed). The counters CASGCRetiredGraduated, CASGCRetiredRedeleted, CASGCRetiredRedeleteFailed keep counting next to CASGCRetiredIntentConfirmed, CASGCRetiredBodyDeleted, CASGCRetiredBodyDeleteFailed. Removed without a replacement: the phase_metrics keys graduated, redeleted, redelete_pending, graduation_due, jobs_completed, jobs_completed_on_entry. Settings: cas_gc_round_graduation_budget is obsolete and its value carries over to cas_gc_round_intent_create_budget; cas_gc_meta_pool_size is obsolete and ignored.
  • Review closely: CA/Gc/CasIntentRules.cpp and its exhaustive test; the adopted-run reader in CA/Gc/CasBlobInDegree.*; republishRef in CA/Parts/PartFolderAccess.cpp; CA/Tools/CasMigratePool.cpp.
  • Commit 8 alone refuses older pools and has no tool; the tool arrives in commit 9.
  • A copy statement can wait. During a store outage a copy or a hardlinking mutation waits up to the request window (120 s) per source part before it fails. KILL QUERY does not interrupt that wait.
  • Known gaps of the backported upstream changes, left as upstream has them. (1) A merge can still combine parts across a mutation that has its block number but is not registered; upstream PR Bound MergeTree selection by allocated but not yet visible versions ClickHouse/ClickHouse#122934 addresses it. (2) Above the Disk connection soft limit an S3 read is cut into one request per buffer fill; on a disk that rewrites keys in place (plain_rewritable) the fills of one read are not pinned to one object version. CAS blobs are content-addressed and are not affected.

Testing

  • Unit: CAS* 4,704 passed (release), 4,707 (ASan, no sanitizer report), on the tree of the working branch before the base merge.
  • Integration on the last tree: test_cas_gc_s3, test_cas_blob_intent_migration (a pool made by the 26.6.4 image), test_cas_shared_pool, test_cas_cross_table_copy_gc (new). The other test_cas_* suites and the 61 CAS stateless tests ran on earlier trees of the same work.
  • TLA+ models of the protocol, of the migration and of the rule on a touched zero: complete runs with no violation; the model without the rule loses a body.
  • Real stores: migration from a 26.6.4 pool, 80+ GC rounds and a soak without faults on AWS S3 and on GCS, on the tree of commit 35: no failed round, no refused delete, pools drained to empty.
  • 2-hour soak with kills, pauses and 11 long freezes of the GC leader, on the tree of commit 33: 24,658 inserts, 220 online checks with no dangling reference, 47 lease takeovers, intents between 0 and 407 with no growth, pool drained to 0 blobs and 0 intents.
  • Lost mutation: reproduced on the previous binary (100 rows instead of 50, 3 of 3 runs), correct with the backport (3 of 3); upstream test 05331 fails before and passes after.
  • Soak with a frozen GC leader (the peer takes the lease in 5 to 9 s): the woken leader sent 69 body deletes and the store refused all 69; 11 of those bodies had been re-uploaded and referenced during the freeze.

Not verified yet

  • Commits 11 to 46 were not built one by one; each is a tree that was built and tested during the work, at the end of its phase.
  • Not run locally: TSan, MSan, UBSan, aarch64, the CAS regression suite. The merged tree (after the base merge, commit 34) was not built locally. 03770, 03990 and 03572 were not run locally on CAS over S3. No rounds suppressed by the parent check were observed in any soak: that path is covered by unit tests only.

Changelog category (leave one):

  • Backward Incompatible Change

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

CAS (content-addressed storage) no longer writes a .meta marker next to every blob: the first INSERT of new data sends half as many PUT requests, and garbage collection leaves nothing behind. Upgrade with care: the pool format changes to generation 4. Stop all servers of a pool, run clickhouse-disks cas-migrate-pool once, then start the new version; older versions can no longer open the pool. The disk needs rights to create, read, list and delete objects under blob-intents/.

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)

filimonov and others added 10 commits November 18, 2026 22:46
`manifestDeletionPremise` rendered the sealed cursor with `renderRefTxnId`,
which throws `LOGICAL_ERROR` on the zero cursor of a live table whose ref
log is empty. The GC round over such a table failed every time. The retain
message now says `none`; the retain decision is unchanged.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`canonicalIdentity` spells one incarnation one way (quoted and bare ETags
compare equal) and rejects tokens that cannot name a blob body: weak,
empty, wildcard, list, over 128 bytes. Nothing uses it yet.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`CountingBackend` records an ordered, thread-safe journal of requests.
`EtagFaithfulPublicationBackend` moves to a shared header.
`DialectOverrideBackend`, `HeadHookBackend`, `seedOlderPoolForTest` and
`markCutComplete` are new. Test-only.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Pool meta carries `token_dialect`, `gc/state` header 4 carries
`intent_sweep_cursor`, condemned rows carry `standing`. A deletion intent
is one constant record keyed by the blob and the canonical identity of its
body; `Layout` builds and parses the key, `createBlobIntent` confirms a
create. `G_BUILD` stays 3 and no server path writes any of it, so a reader
at the default ceiling still refuses these objects.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`StreamingBlobPublication` carries the expected `BlobRef`. Every streaming
`publish` checks the size and digest of exactly the bytes it forwards and
refuses to complete the object on a mismatch: `CORRUPTED_DATA`, counted by
`CASBlobPublishDigestMismatch`, not retried. A wrong size is reported
before a wrong digest.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The capability probe refuses a store whose `HEAD` token names no
incarnation, and reports a refused write (`READONLY`, `EACCES`, `EPERM`,
`EROFS`, S3 denials) at once instead of retrying to the deadline.
`runIntentPrefixProbe` checks the `blob-intents/` rights under a scratch
sub-prefix and names the missing right; nothing calls it yet.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`decideIntentStep` maps one GC row, the cut of the round and its decision
`HEAD` to one step; `decisionHeadNeed` says which `HEAD` a row needs. The
test walks every reachable cell of the rule table and checks that every
unreachable one throws. No GC round calls the rules yet.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
- `G_BUILD` is 4; new pools start at floor 4 with the store token dialect.
- Every open refuses an older pool or another dialect; a writable open
  proves the `blob-intents/` rights.
- The writer adopts a present body only when its token has no intent.
- GC creates intents in a budget; later rounds delete body, then intent.
- Orphan intent sweep; marker code removed; `cas-fsck` checks intents.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`migratePool` converts a stopped pool from blob markers to deletion intents
in steps that can each be repeated, so a rerun completes a run that stopped
anywhere. `clickhouse-disks` defers the pool open of the disk for this
command only and refuses it beside other commands.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Protocol, garbage collection, migration, fsck, monitoring and bucket-rights
pages for the intent protocol; renamed counters and `cas_log`/`cas_gc_log`
columns.

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

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Workflow [PR], commit [939a6bd]

filimonov and others added 16 commits November 20, 2026 14:28
A blob referenced again while its GC row was `pending` or `standing` kept
`I(B,t)` after a writer had replaced the body: an orphan no round removed.
In an unsuppressed round the fold sends a `HEAD` for such a row and adds
`I(B,t)` to the round's intent deletes when the body shows another
canonical identity; the same token, an absent or short body keep it.
The `HEAD`s run on the GC I/O pool within `gc_io_concurrency`; counted in
`CASGCIntentDeletedOnSpare`. The test fakes' once-hooks take a mutex.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Tools that read the row by name lost `entries_graduated`,
`entries_redeleted` and `entries_redelete_failed` with the counter rename.
The row keeps them after `pending_retired`, filled with the values of
their renamed counterparts.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
GC could delete a body a committed part names. A no-bytes copy into
another namespace between two frontiers of one round, into a namespace
born after the catalog read, or of a republished body escapes the other
namespace's cut, so the count reaches zero. Only a zero after a round
that folded no record of the blob proves no part names it: otherwise
`decideIntentStep` carries the `pending` row. Tests reproduce each case
in both walk orders, with controls that keep the body.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A GC leader paused after its intake could read a ref log a newer leader
had cleaned as the end of the stream, and delete bodies live parts name.
When the adopted parent holds a `pending` or `standing` row, one `HEAD`
of `gc/state` before the reduce must show the leased version. Otherwise
the round sets `suppress_destructive` with reason `parent_unconfirmed`
and deletes no body and no intent.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A rebuild derives edges from owner state. A live precommit with an
unreadable manifest left its blobs uncounted, and a later zero transition
deleted a body the promoted part names; the rebuild refuses such a pool.
A refused rebuild gives back its lease claim with one conditional write:
a rebuild never steals and each run takes a fresh identity, so a kept
claim made every retry refuse as a competing leader. A lost give-back is
logged.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A copy without bytes could promote a part whose source was dropped and
whose body GC deleted: the new part named a missing body. After
`precommitAdd`, a hardlink confirms each distinct source with
`Pool::confirmExactRef` and `republishRef` the source binding it read;
an unconfirmed source takes the build back with `NO_REPLICA_HAS_PART`.
In-process callers wait for the state lock; the relink sender keeps
`TryLock`. Also carries smaller fixes to the parent check and the rebuild
refusal, and a test-only fix of a flaky namespace-removal test bound.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
An untouched zero proves no reference only if a round walks every live
namespace from its first record. Tests pin that for a namespace first
seen in the round, one the stream listing omits and one re-created under
an old name; that a `Creating` life refuses a precommit; and that the
catalog read follows the lease acquisition. Docs explain the untouched
zero, the `parent_unconfirmed` check and the copy-source confirmation.
No product change.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`Gc::setRoundPointHookForTest` runs a callback after the catalog read,
after each namespace walk, after the intake and before the `gc/state`
commit. `CASInterleave` copies a part by `createHardLink`, `republishRef`
and relink at each point, for each row state, hop shape and walk order,
and checks that no part names a missing body. Adds deposed-leader,
late-delete and lost-validation tests. Also pins that a life with a
published snapshot is walked from its first record; corrects GC docs.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
- A store whose `gc/state` token has no canonical identity (a weak ETag)
  suppressed every body delete: the parent check compares exact tokens.
- A deposed leader whose parent runs a newer leader pruned failed with
  `CORRUPTED_DATA`: when `gc/state` moved, the round ends with `ABORTED`.
- A pending row over an undecodable body took the only
  `cas_gc_round_redelete_budget` slot every round, starving the rest.
- A rebuild over an unreadable live precommit reports a soft refusal.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Integration suite `test_cas_cross_table_copy_gc`: `MOVE`, `ATTACH` and
`REPLACE PARTITION`, `CLONE AS`, a namespace-changing `RENAME` and a
relink fetch, each followed by a drop of the source, with GC rounds in a
loop; plus `SYSTEM CAS GC REBUILD FORCE` on a pool with GC history. It
does not force an interleaving inside one round: unit tests cover that.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`ConfirmLockMode::Wait` waited for a table's `state_mutex` holding
`ref_queue_mutex`, so appends of every table queued behind one copy: it
waits holding no ledger lock, until the request window passes. A store
error during the confirm became a retryable refusal, and `republishRef`
then completed by dropping the source: the error propagates. Staged
entries clear and re-key in linear time; the copy matrix covers relay
pass 2 and several GC shards. Also tightens the integration copy tests.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
- `cas_gc_round_redelete_budget` bounds pending-row `HEAD`s; the next
  round resumes after the last row that took a slot.
- A `cas_gc_round_graduation_budget` cap lost on upgrade applies to
  `cas_gc_round_intent_create_budget` unless that is set.
- A deposed leader's seal read and drain end with `ABORTED`.
- `cas-migrate-pool` checks the seal, `gc_shards`, the intent prefix and
  token form, also with `skip_access_check`. `cas-fsck` reports pending
  rows gone before the scan in `pending_intent_absent`.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A cross-part `moveFile` took the only pending record from a hardlink left
in the source part, so a committed source could promote a body nobody
uploaded. A blob entry with no record and no copy source throws
`LOGICAL_ERROR`. A copy confirm holds the source table between its wait
and next pass, and its refusal says whether the source changed. Also:
the redelete position survives a suppressed round, and `cas-migrate-pool`
applies the GC merge's row rules to every inherited run before the floor.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Shared test helpers (`messageOf`, `MissedWriterPool`,
`ReadAheadWindowProbe`, the publication fixture) replace per-suite copies.
Product code gains `CountWithExample`, `copyVerifiedPayloadAndFinalize`,
`forEachChangedSlot`, `precommitAndUpload` and `ShardFoldOptions`, defines
the `SYSTEM CAS FSCK` columns in one list and drops two unused parameter
modes. Log lines, column names and orders, and request order are kept.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The fold and `cas-migrate-pool` M3 read a parent seal's runs through
`AdoptedRunReader`. It refuses a row of another GC shard, rows out of
`(BlobRef, source_id)` order and a row stamped after the parent round;
M3 drains every run before any intent or floor change. The five GC
refusals advised `cas-gc-rebuild`, which refuses any pool whose GC held
the lease: they say GC stops reclaiming and stored data is not affected.
`cas-fsck` checks its deadline before each present pending body request.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`republishRef` could remove a committed destination when its source was
repointed meanwhile. Once the destination commits the source's content,
it removes only the exact source; a repointed source throws
`CAS_OWNERSHIP_CONFLICT` and keeps both bindings. The copy confirm runs
on the table runtime the resolution pinned, under one request deadline,
and a borrow follows the transaction's own rename of its source. A part
emptied of its staged files is a `LOGICAL_ERROR`, not a retry loop.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
@filimonov
filimonov marked this pull request as ready for review November 20, 2026 14:14
@filimonov
filimonov requested a review from k-morozov November 20, 2026 14:15
@filimonov filimonov added the CAS label Nov 20, 2026
filimonov and others added 13 commits November 21, 2026 02:02
`cas-migrate-pool` queued a body for its deletion intent only when the
body's own key was in the listing. A body whose `Clean` legacy marker was
listed while its key was not got no intent, and the run still raised the
pool floor. Every marker the tool reads now queues the blob it names; the
dry run counts the same candidates.

Adds tests for a refusal on a later listing page and for the dry-run
preview of a `standing` row; corrects the migration and fsck docs.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`test_fetch_paused_before_confirm_then_source_dropped` failed with
"the fetched part is committed but does not read back in full". After a
refused fetch the part-check thread replaces the lost part with an empty
part of the same name; the test took it for a committed fetch.

The refusal branch now also asserts from `system.part_log` that no
`DownloadPart` with rows was recorded.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
A copy that reads no bytes (`ATTACH PARTITION FROM`, a mutation that
hardlinks) confirms its source and reads the mount slot for that. The
read made one attempt, so one transient store timeout failed the
statement: `Code: 499 ... Poco::Exception ... Timeout (S3_ERROR)`.

The in-process confirm now uses the standard bounded retry policy,
capped at its deadline; a spent budget still propagates. The confirm a
peer asks for keeps one attempt: its failure is a refusal the peer's
replication queue retries. A test pins that single attempt.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
One pass of the source confirmation answers `Unknown` on states a
healthy server passes through: above all when this server's own mount
lease renewal lands between the slot read and the ownership check. The
in-process confirm had no second ask, so a mutation or a copy failed with
`NO_REPLICA_HAS_PART` "could not be confirmed".

`Pool::confirmPinnedRef` now repeats the whole pass (ownership capture,
ledger snapshot, slot read) until `Yes`, `No`, or its existing deadline.
`No` is final. A refusal that cannot clear (a retired pin, a closed or
faulted lane) stops at once. A pool teardown ends the wait with
`ABORTED`, also inside the slot read's retries. Each `Yes` is the same
full proof as before; only the number of passes changes.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`test_a_first_attempt_timeout_is_reissued_as_attempt_two` delayed the
conditional `PUT` by 3000 ms, equal to the client's first-attempt receive
timeout. When the delayed `PUT` landed first, the client settled by
reading back and no reissue was captured. The delay is now 6000 ms.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Each blob upload held a fixed write buffer, so a query fanning out many
small uploads exceeded its memory limit:
`03770_min_columns_to_activate_adaptive_write_buffer` failed with
"Query memory limit exceeded: would use 50.24 MiB".

The buffer is sized to the envelope and payload plus one byte. The extra
byte matters: a buffer that is exactly full doubles in
`WriteBufferFromS3` before the upload (a 900 KiB body peaked at 2.77 MB;
now 0.93 MB).

Origin: commit ac144e848aa5 of branch work/antalya-26.8/cas-upload-buffers,
adapted to this branch (`emuPublishBlobAtomically` reads the payload size
from the publication) and extended with the one-byte margin and a test
that measures the peak allocation.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The CAS-on-S3 MSan lanes ran 3 shards of about 4700 tests on a 32 GiB
runner. The test runner retires a worker whenever server RSS passes 80 %
of its limit, so each shard dropped from 6 workers to 1 within 40 minutes
and hit the job time limit. TSan shards of 7000 tests did not fit either.

MSan: 6 shards on `AMD_LARGE` with a 4 h timeout; TSan: 4 shards on
`AMD_LARGE`: the runner and shard count of the ordinary lane of the same
sanitizer. ASan already matched.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
`03572_export_merge_tree_part_limits_and_table_functions` expects 5
exported files. The export sink rotates files only between chunks, so the
count depends on how the part is read; randomized `index_granularity`
settings gave 4. The test table now pins them.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…date of it is uncommitted

A mutation could pick a part while a lightweight `UPDATE` with a lower block number had not
written its patch part yet; the mutated part then skipped the patch and the acknowledged update
was lost. This branch needs it as the base of ClickHouse#124167 (lost lightweight `DELETE` in CI).

Upstream: ClickHouse#119155
Upstream merge commit: 72006b7
Commits of the upstream pull request:
- 8a53df6 Merge remote-tracking branch 'origin/master' into mergetree-mutation-pending-patch-116686
- 7638e85 Tag `05227_mutation_waits_for_lightweight_update` as `no-fasttest`
- d9f77ec Merge remote-tracking branch 'origin/master' into mergetree-mutation-pending-patch-116686
- 4398d33 Wake up the postponed mutation and make the test deterministic
- cf21123 Merge remote-tracking branch 'origin/master' into mergetree-mutation-pending-patch-116686
- ea880f9 Merge branch 'master' into mergetree-mutation-pending-patch-116686
- 8db4dc2 Leave a part alone while a lightweight update of it is uncommitted

Adaptation for antalya-26.8:
- None: applied as is.

(cherry picked from commit 72006b7)

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ed and reported done in MergeTree

A mutation takes its block number before it is registered. A part mutated in that window
moved past the unregistered version, so its commands were never applied while the mutation
reported done. Seen here as an acknowledged lightweight `DELETE` lost in CI
(`cas_lightweight_delete`): mutation 16 registered before mutation 15.

Upstream: ClickHouse#124167
Upstream merge commit: 9355332
Commits of the upstream pull request:
- f112590 Do not skip a mutation that has its block number but is not registered yet

Adaptation for antalya-26.8:
- `src/Storages/StorageMergeTree.cpp`, `StorageMergeTree::getMutationVersionForMergedPart`:
  hunk dropped. The function and `isMaterializedByMerge` do not exist on this branch: a merge
  here never records a mutation version above its source parts.
- `05331_mutation_not_skipped_before_registration`: kept as is. Both cases, including
  "a merge materializes the DROP COLUMN first", fail without this change and pass with it.

(cherry picked from commit 9355332)

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
…ion per idle stream above the soft limit

A reader that keeps many S3 streams open held one pooled connection per stream, idle between
fills. Above `disk_connections_soft_limit` each fill becomes its own ranged request whose
connection returns to the pool at once. Seen here on the CAS-S3 lanes: a horizontal merge of
`system.metric_log` (2425 columns) holds thousands of sessions, and the warning
`Too many active sessions in group Disk` fails random tests.

Upstream: ClickHouse#119730
Upstream merge commit: 6f80dda
Commits of the upstream pull request:
- 09f900d Make `CountedSession::total` atomic in `gtest_readbuffer_s3`
- 8221d48 Merge branch 'master' into fix-s3-read-buffers-hoarding-connections
- c69cee4 Release the failed request in `readBigAt` before the retry back-off
- 02a5405 Merge remote-tracking branch 'origin/master' into fix-s3-read-buffers-hoarding-connections
- 4cd8d1f Stop S3 disk reads from holding a connection per idle stream above the soft limit

Adaptation for antalya-26.8:
- None: applied as is. `ReadBufferFromS3::initialize` merged without conflict around this
  branch's response-identity check: `pending_response_etag` is still recorded after
  `sendRequest`, so every cut request is checked against `last_delivering_response_etag`.

(cherry picked from commit 6f80dda)

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
… event and stop 04812 from counting cut requests

Counts the S3 disk reads cut to one buffer fill by ClickHouse#119730, so the cut is visible in
`system.events` and `query_log`. `04812_prewhere_fragmented_ranges_s3_read_requests` asserts
a request count and fails when the server is above the soft limit; it now excludes cut requests.

Upstream: ClickHouse#124701
Upstream merge commit: 35cab67
Commits of the upstream pull request:
- 743e625 Add ReadBufferFromS3RequestsCut profile event and stop 04812 from counting cut requests

Adaptation for antalya-26.8:
- None: applied as is.

(cherry picked from commit 35cab67)

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Conflicts: `.github/workflows/master.yml` and `pull_request.yml` (both
sides changed the generated job lists). Resolved by regenerating them
with `python3 -m ci.praktika yaml` from the merged `ci/defs`.

Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
@filimonov

Copy link
Copy Markdown
Member Author

CI triage at 939a6bde149. Seven distinct reds; one is addressed by this line of work, six are not caused by this PR.

Red Cause Verdict
Stateless tests (amd_msan, cas s3 storage, parallel, 3/6): 02235_add_part_offset_virtual_column ReadBufferFromS3 keeps the HTTP session of a read that fits in one buffer fill. A horizontal merge of metric_log (2,437 columns) holds about 2,900 sessions per Wide source part, and the Disk group goes above its warning limit. Fixed in #2941 (15ee7cc5f61): peak active sessions 9,604 to 125 on a local repro.
Stateless tests (amd_binary, cas s3 storage, parallel): 04890_iceberg_metadata_spec_violation_no_abort Race between two exceptions on an IcebergLocal table: ICEBERG_SPECIFICATION_VIOLATION (expected) or BAD_GET, whichever thread throws first. 2 of 12 local runs hit BAD_GET. No CAS or S3 code involved. Not this PR.
Stateless tests (arm_binary, parallel): 04218_limit_by_partitions_independently Plan flip in one EXPLAIN PIPELINE. 19 of 19 reruns with the same randomized settings pass. This PR touches no read-path file. Cause of the flip not found. Not this PR; flaky.
Stress test (amd_debug): Server died AST fuzzer query: SELECT DISTINCT ... ORDER BY over a Merge table over Distributed with a String to Decimal cast trips a debug-only chassert in DistinctSortedStreamTransform. Same bug class as ClickHouse#124361. Not this PR; upstream.
Regression release tiered_storage_minio: simple replication and moves No space left on device on a 40 MiB jbod1: the scenario fills the disk faster than the mover frees it. The same test fails on the base branch. Not this PR; test margin.
Regression settings (release and aarch64) The settings snapshot in the regression repository lags the base branch by 4 settings. Not this PR.
Grype scans (keeper, server, server alpine) High and critical CVEs in image packages. Not this PR; base images.

@filimonov
filimonov merged commit 9be3ad6 into antalya-26.8 Nov 23, 2026
671 of 692 checks passed
@svb-alt svb-alt added the verified-with-issues Verified by QA and issues found. label Nov 23, 2026
k-morozov added a commit that referenced this pull request Nov 23, 2026
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]>
@DimensionWieldr

Copy link
Copy Markdown
Collaborator

AI found no defects.

CI triage looks fine, outstanding issue addressed by #2941.

CAS checks: https://github.com/Altinity/clickhouse-regression/actions/runs/44818609091/job/136573396383

  • alter attach partition fails because this run was from a commit before 064424a and f199430 which fix the issue
  • alter stress fails unrelated to CAS

Verified with issues.

@DimensionWieldr DimensionWieldr added the verified Approved for release label Nov 23, 2026
k-morozov added a commit that referenced this pull request Nov 23, 2026
Use the ETag from the fold's decision to group conditional blob deletes
by shard. A replacement written after the fold survives the delete.
Keep deletion intent cleanup on the separate write-once path introduced
in #2917.

Co-authored-by: Codex (GPT-6) <[email protected]>
Signed-off-by: Konstantin Morozov <[email protected]>
@CarlosFelipeOR

Copy link
Copy Markdown
Collaborator

After this PR was merged, the integration test test_cas_cross_table_copy_gc failed 5 times under ASAN in the nightly run (MasterCI): https://s3.amazonaws.com/altinity-build-artifacts/REFs/antalya-26.8/9be3ad607ce760b0070910ef856b72a0cbb55d1b/45297178056/ci_run_report.html#checks-fails
@filimonov or @k-morozov Could you please fix it?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants