Repository navigation
Conversation
A cold reader could see the catalog row `Live`, then lose the CPU before `acquireRefTableRuntime` took `ref_queue_mutex`. Removal plus the GC drain retired the life and erased the slot, so the reader inserted a fresh runtime for the dead life. A warm `namespaceLife` then returned it and `putNamespaceFile` acknowledged bytes the dead-life janitor later deletes. - `RefNameSlot` keeps a per-name `retirements` count; `invalidateRemovedCatalogLife` bumps it instead of erasing the slot, also when no runtime is resident. Eviction keeps slots with a non-zero count. - Every cold path captures the count before its first catalog GET; `acquireRefTableRuntime` throws retry-later if it moved. - `namespaceLife` refuses a recovered runtime whose terminal removal is applied. Draft: not built or tested yet. Signed-off-by: Mikhail Filimonov <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
`invalidateRemovedCatalogLife` returned without bumping the name's retirement count when a successor life was resident. A delayed cold admission of the predecessor could then insert it once the successor was evicted. The count is now bumped for every retirement, while invalidation and detachment stay limited to the exact predecessor runtime. New tests: - a delayed predecessor retirement with a successor resident advances the count, leaves the successor attached, and the count survives eviction; - `namespaceLife` refuses a recovered terminal runtime whose removal-admission flag is clear, on the cold call and on the warm one; - the cold `namespaceLife` window between its catalog read and its insertion. Draft: not built or tested yet. Signed-off-by: Mikhail Filimonov <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
Draft: not built or tested yet. Signed-off-by: Mikhail Filimonov <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
Stateless tests (amd_binary, cas s3 storage, parallel) and Stateless tests (amd_debug, parallel): |
PR #2570 Audit ReviewVerdictNo High defect. The guard is correct for the window it was written for, and the window it was written for is the real one. A cold admission that reads a Two Medium gaps, both from one root: the retirement record is written after the catalog row is already gone, and only in the process that happens to hold the GC lease. One Low on the memory and lock cost of a record that is never released before remount. What the change does
Five cold paths capture the count before their first catalog read and hand it to
A second gate, Several test accessors in Model
The central argument, and why it holdsThe race the PR describes is real and the shape of the fix matches it. The slot, not the runtime, is what must remember a retirement, because Comparing by Recording whatever runtime is resident, a successor included, is also right. The successor's own eviction cannot drop the record, which the new The second gate earns its place. Where the counter misses, a runtime installed for a retired life still recovers from that life's durable stream, finds the terminal FindingsTiming / orderingMedium: the retirement is recorded one or more object-store round trips after the catalog row is erased.
Medium: a retirement performed by a remote GC leader is never recorded on the server that owns the namespace.
Backpressure and resource limitsLow: on the GC leader, every namespace retired anywhere in the pool leaves a permanent map entry.
Observability and diagnosabilityLow: the new refusal is worded as a write failure on paths that are not writes.
Two things that look like defects and are not, recorded so the next reader does not re-derive them. Coverage
Assumptions: static reading of head Operational readinessScope. Primary flows
Issues1. A retryable error on an insert that names a namespace the operator did not touch
2. The same error text appears on a read
3. On a non-leader server the dropped-then-recreated case is still exposed
Readiness verdict
Operator guidanceTreat Recommended fixes
|
PR #2570 CI VerificationVerdictNo regression in what ran. Approval is blocked on what did not: every CAS regression suite was skipped. Six checks are red. Not one of them is a named test failure that the diff can reach. Two stateless jobs died on the same
The blocking item is not in that table because it is not a failure. The PR body ticks How the list was reduced
Only the head commit ever got a CI run. The PR has three commits — What passed, and why it matters hereThis is a CAS-internal change, so the CAS-flavoured jobs are the relevant signal, and they are green:
The PR's own new tests are covered. Every regression suite that ran is clean in FindingsThe CAS regression suites never ranThe PR body ticks the CAS regression box: Every CAS job in the run came back That matters more for this change than it would for most. The diff alters when a namespace runtime may be published and adds a gate that refuses a writer outright, so its realistic failure mode is a retryable error raised where none was raised before — a Not a failure, and not evidence of one. It is a hole in the evidence, and it is the hole most likely to contain a problem with this specific diff. Re-run with the CAS suites before approving.
|
| Job | Side | Commits | With this abort |
|---|---|---|---|
Stateless tests (amd_debug, parallel) |
other PRs | 623 | 11 (1.8%) |
antalya-26.6 branch |
80 | 0 | |
| PR 2570 | 1 | 1 | |
Stateless tests (amd_binary, cas s3 storage, parallel) |
other PRs | 320 | 16 (5.0%) |
antalya-26.6 branch |
20 | 0 | |
| PR 2570 | 1 | 1 |
The branch zeros on those two job names are not a clean baseline, because the abort is not confined to them. On branch runs it has fired eleven times across nine different stateless jobs in the same window, including the CAS-storage variants: arm_binary, parallel (3), amd_binary, cas storage, arm_binary, cas s3 storage, amd_msan, cas s3 storage, amd_tsan, cas s3 storage, amd_tsan, parallel, amd_tsan, s3 storage, amd_asan_ubsan, distributed plan, amd_msan, WasmEdge. It is a branch-wide problem that lands on whichever job happens to schedule the query.
Across all jobs it has hit thirty pull requests in 60 days and is still live: the two most recent hits are PRs 2644 and 2420, both on 2026-10-23, nine days after this PR's run. The assertion is in aggregation transform code; this diff touches CasRefLedger, CasPool.h, and one gtest file, with no path to it.
Unit tests (asan_ubsan) — pre-existing-flaky
IcebergMetadataGenerator.ModifyColumnAfterItselfWithoutTypeIsNoop fails on a UBSan report:
/ClickHouse/src/DataTypes/IDataType.h:380:67: runtime error: member call on null pointer of type 'DB::IDataType'
#0 DB::WhichDataType::WhichDataType(...) src/DataTypes/IDataType.h:380:67
#1 DB::isNothing(...) src/DataTypes/IDataType.cpp:520:1
#2 DB::Iceberg::stripNothing(...) src/Storages/.../Iceberg/MultipleFileWriter.cpp:34:9
#3 DB::Iceberg::checkUnknownTypeAllowed(...) src/Storages/.../Iceberg/Utils.cpp:554:32
| Who | Runs | Fails | Rate |
|---|---|---|---|
| Other PRs, this job | 179 | 38 | 21% |
antalya-26.6 branch, this job |
13 | 1 | 7.7% |
| PR 2570 | 1 | 1 | one run |
Fifteen other pull requests hit it in the window, most recently 2574 and 2567 on 2026-10-19. The stack is entirely in Iceberg metadata generation and IDataType; the diff touches neither. One failure against a 21% baseline is what that baseline predicts.
Integration tests (amd_asan_ubsan, db disk, old analyzer, 1/8) — infrastructure
The shard passed everything it ran and was then killed by its own deadline:
!!!!!! xdist.dsession.Interrupted: session-timeout: 10800.0 sec exceeded !!!!!!!
==== 617 passed, 43 skipped, 1 xfailed, 11 warnings in 10829.94s (3:00:29) =====
Error [Integration tests (amd_asan_ubsan, db disk, old analyzer, 1/8)]
| Test execution was interrupted (exit status: 2)
The database agrees: 619 OK, 43 SKIPPED, and zero FAIL rows for this job on this PR, with check_status = error recorded at job level only. Shards 2/8 through 8/8 all succeeded.
This shard is the slow one and runs close to its budget routinely. Counted by commit over 60 days: antalya-26.6 branch 5 of 37 commits red (13.5%), other pull requests 40 of 408 (9.8%), PR 2570 1 of 1. An asan+ubsan integration shard that overruns three hours about one time in eight is the baseline, not a new failure mode. Rerun.
GrypeScanServer (-alpine) and GrypeScanKeeper — infrastructure
Both scans fail on Alpine distro advisories, severity High, against openssl 3.3.7-r1 in the libcrypto3 and libssl3 apk packages — namespace alpine:distro:alpine:3.21, fixed upstream in 3.3.7-r2. CVE-2026-84782 is the DTLS retransmission out-of-bounds read; CVE-2026-84784, CVE-2026-85091 and CVE-2026-72897 are alongside it on the keeper image.
The finding ids are distro package matches, not anything compiled from this diff, and the diff changes no Dockerfile, package list, or image base. A rerun scans the same base layer and fails identically. These clear when the base image picks up the patched apk, not on this PR.
Recommendation
Do not approve yet — re-run CI with the CAS regression suites enabled. Nothing in the current run implicates the diff, and the CAS stateless and stress jobs plus 2,593 CAS gtests under asan and ubsan are real positive signal. But the suite that would exercise a namespace drop and recreate against a live server never ran, and that is precisely the path this change alters.
Once the CAS suites are green, approve on CI grounds. Of the six current reds, a rerun may clear the two stateless aborts (1.8% and 5.0% per commit) and the integration shard (about 10%). It will not clear Grype, and the Iceberg unit test fails on roughly one in five runs across the fork, so either may stay red. None of those should block.
The GC drain recorded a retired life only after the erase and the resolution reads that follow it. A cold admission that inserted its runtime inside that interval saw an unchanged retirement count and published a runtime for a life whose row was already gone. `deleteCompletedRemovingAtSnapshot` now takes a `before_erase` callback that runs once, after admission is confirmed and before the first erase. The GC drain passes `invalidateRemovedCatalogLife`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Mikhail Filimonov <[email protected]>
A life drained by another server's GC leader is never reported to the owning server, so the owner's idle runtime was evicted with a zero retirement count and its slot erased. A cold admission that had read the row `Live` before then installed a runtime for the dead life. `enforceRefTableCacheBudget` now bumps the count, and so keeps the slot, when the evicted runtime had closed its removal admission or applied a terminal removal. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Mikhail Filimonov <[email protected]>
A `SELECT` or presence probe that lost the retirement race failed with "CAS write could not be committed", naming a write that was never attempted. Read paths now use the disk-state refusal; the error code is unchanged. Write paths keep their wording. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Mikhail Filimonov <[email protected]>
The parked thread registers itself before its first request instead of being assigned after the thread starts, and a guard releases and joins it when an assertion fails. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Mikhail Filimonov <[email protected]>
The drain announces every retired life before its erase, so re-recording after the drain only bumped the count twice. Comments that placed the invalidation after the deletion now say it can precede the erase. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Mikhail Filimonov <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Mikhail Filimonov <[email protected]>
|
Thanks for the audit. Status per finding:
CI: the CAS regression jobs did not run on the last head although |
|
For 26.6 - abandoned (real bug, but narrow). For 26.8 - becomes a part of #2831 |
A cold admission of a namespace runtime could publish a life that was retired while it waited, and a re-created table then wrote acknowledged files into that dead life. The cold path reads the catalog row (
Live, life L), then takesref_queue_mutexto install the runtime; no lock is held in between. IfDROP TABLEand the GC drain retire L in that window,invalidateRemovedCatalogLifeerases the name's slot, and the delayed insertion installs a runtime for L into the empty slot. A table re-created with the same UUID then gets L from the warmnamespaceLife,putNamespaceFileacknowledges its files, and the dead-life janitor deletes them.Changes
RefNameSlotkeeps a retirement count.invalidateRemovedCatalogLifebumps it underref_queue_mutexand clears the slot's runtime instead of erasing the slot, whatever runtime is resident, including a successor's. Evicting an idle runtime whose removal admission is closed or whose terminal removal is applied also bumps the count, so a life drained by another server's GC leader (which never callsinvalidateRemovedCatalogLifehere) still leaves a record. A slot with a non-zero count is never erased.before_erasecallback ofdeleteCompletedRemovingAtSnapshot), not after the drain returns.acquireReadableRefTableRuntime,namespaceLife,namespaceStillLogicallyPresent,dropNamespaceImpl,acquireMutableRefTableRuntime.acquireRefTableRuntimerefuses with a retryable error if the count moved; the retry re-reads the catalog.namespaceLiferefuses a runtime whose recovered state is terminal.acquireReadableRefTableRuntime,namespaceStillLogicallyPresent) refuse a stale observation with the transient-unavailability wording (NETWORK_ERRORkept) instead of "CAS write could not be committed".Risks / notes
Testing
DROPand two GC rounds (a test backend runs them during the second catalog GET); a retirement recorded while a successor is resident survives its eviction;namespaceLiferefuses a recovered terminal life.ColdReaderIsRefusedWhenReleasedRightAfterTheDrainErasesItsRow).ColdAdmissionIsRefusedWhenARemoteLeaderRetiredTheLifeAndTheRuntimeWasEvicted).AnnouncesEachLifeBeforeItsRowIsErased,AFailingAnnouncementSendsNoErase), and once across a conflict retry (RetriesFromTheMandatoryConflictResolutionCut).ColdReaderDoesNotRepublishALifeRetiredAfterItsCatalogRead).CAS*unit tests ondca5e45ce32: release 2639, ASan 2643, all passed.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
CAS: a table dropped and re-created with the same UUID could have acknowledged table files deleted by GC, when a concurrent read admitted the dropped table's namespace while the drop completed.
Documentation entry for user-facing changes
CI/CD Options
Exclude tests:
Regression jobs to run: