Repository navigation
Conversation
…xpired The disk space estimate that both mutation paths reserve skipped a part whose TTL had expired for every row, so such a mutation reserved only the 1 MiB minimum. The skip was added for TTL drop merges, which write nothing for such a part. A mutation does write it: `ALTER UPDATE` and `MATERIALIZE COLUMN` do not execute TTL, and even with `ttl_only_drop_parts` the whole mutation runs before its result is replaced with an empty part. On a single disk the mutation size gate hides this, because it counts expired parts. On a volume with several disks the gate uses the free space of the roomiest disk, so the mutation starts, writes into the part's own full disk and fails with "No space left on device" on every retry. Inserts into other tables on that disk then fail with NOT_ENOUGH_SPACE. Mutations now reserve the size of the source part whether or not its TTL has expired, through their own estimate. The merge estimate and the selection gates are unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding) and my own cold review. All findings are nits; none needed a code change.
Severity: ❌ blocker / Session id: cron:clickhouse-review-slot-11:20260926-221503 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-4:20260926-205300 |
|
Workflow [PR], commit [fff83e4] Summary: ✅
AI ReviewSummaryThis PR splits mutation disk-space estimation from merge estimation so a fully expired part now reserves space like any other mutation, and it adds integration coverage for plain, Final Verdict✅ No blocking issues found. LLVM Coverage ReportMeasured on commit fff83e4.
Changed lines: Changed C/C++ lines covered: 10/10 (100.00%) · Uncovered code |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units14 translation units recompiled, 142 s compile time in total, 14 of them have a recent master baseline. |
Related: #122391
Related: #122280
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixed a mutation (for example
ALTER TABLE ... UPDATE) of a part whose TTL had expired for every row reserving only 1 MiB of disk space. On a storage policy with several disks, such a mutation wrote into the part's disk even when it was full, failed withNo space left on deviceon every retry, and could make inserts into other tables on that disk fail. It now reserves the size of the part, like the mutation of any other part, and waits for free space.Description
On 26.9.1.1629 and 26.8.10.6, an
ALTER TABLE ... UPDATEof a part whoseDELETETTL has expired for every row, on a storage policy with several disks, reserves 1 MiB, writes into the part's full disk and fails withNo space left on deviceon every retry. Inserts into other tables on that disk meanwhile fail withNOT_ENOUGH_SPACE(6 of 439 over 4 runs, 0 of 440 with this PR). Such a part survives, for example, while TTL merges are stopped.Both mutation paths reserve through
CompactionStatistics::estimateNeededDiskSpace, which counts a fully expired part as zero bytes, a skip meant for TTL drop merges (#43222). A mutation rewrites the part:ALTER UPDATEdoes not execute TTL, and even thettl_only_drop_partsshortcut writes the whole result before swapping in an empty part. The size gate counts the part, but against the roomiest disk of the policy, while the mutation writes on the part's own disk.Both paths (
MergeTreeandReplicatedMergeTree) now reserve the part's size through a newestimateNeededDiskSpaceForMutation. Parts that have not expired reserve as before; merges and the gates are untouched (the merge side is #122391, whose AI review raised this). Trade-off: a mutation that writes little, such as a TTL-executingMATERIALIZE TTL, now waits for space on a full disk of such a policy, as it already does on a single disk.The new integration test (plain,
ttl_only_drop_partsand replicated cases) checks that the mutation does not start while the part's disk is full and reserves at least the part's size once space is freed. It fails on master, 26.9 and 26.8 and passes 13/13 runs with the fix; reverting either call site fails exactly its own cases.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/122481]