Repository navigation
Rebuild broken and missing commit-order projections from the part's data in a partial mutation - #124912
Rebuild broken and missing commit-order projections from the part's data in a partial mutation#124912groeneai wants to merge 5 commits into
Conversation
…tions A part never carries a commit-order projection after an insert, so `MutationsInterpreter` rebuilds it in every mutation of such a part. Unlike `MATERIALIZE PROJECTION`, that branch did not register the projection's required columns as dependencies, so a mutation that rewrites only some columns of a Wide part did not read them. `calculateProjection` then filled the missing columns with type defaults: the projection stored zeros, and a read in insertion order returned them. When the part already stored `_block_number` (after a merge, a lightweight delete, or `ATTACH PARTITION FROM`), `getPhysical` threw `NO_SUCH_COLUMN_IN_TABLE` for the virtual column and the mutation was retried forever. Register the required columns as readonly `PROJECTION` dependencies before the stages are built, as `MATERIALIZE PROJECTION` does. The readonly stage reads them without rewriting them. On-the-fly read interpreters are excluded: they never write the projection. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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; 2 rounds, 1 finding, 0 in the re-review) plus my own review (3 nits).
Severity: ❌ blocker / Session id: cron:clickhouse-review-self-slot-58:20261009-124700 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-self-slot-57:20261009-122300 |
|
Workflow [PR], commit [0d3c721] Summary: ✅
AI ReviewSummaryThe change registers the columns required to rebuild broken projections and missing commit-order projections before mutation read stages are prepared, preventing default-filled projection data and repeated Final Verdict✅ Approve — no new actionable issues found. Both focused regression tests pass in CI for commit |
Build profile diff (arm_release)Commit See the job log for details. |
A mutation rebuilds every broken projection of the part it rewrites, but MutationsInterpreter only added the projection to materialized_projections, after the dependencies had already been turned into read stages. A mutation that rewrites only some columns of a Wide part therefore did not read the projection's columns, and PartMergerWriter::calculateProjection filled the missing ones with type defaults: - a plain projection was rebuilt with zeros and then returned wrong rows; - a commit-order projection on a part that stores _block_number failed with NO_SUCH_COLUMN_IN_TABLE on every retry; - when the block had none of the projection's columns, the projection was dropped from the new part. Register the projection's required columns as readonly PROJECTION dependencies in the same place as for a missing commit-order projection. The test breaks the projection files in a private clickhouse-local path and then updates a column the projection does not use. Co-Authored-By: Claude Opus 5.5 <[email protected]>
CI finish ledger - 3e5395aEvery failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20261009-220010 |
…er-projection-partial-mutation
05340 is also used by ClickHouse#124912 and by master's 05340_projection_lightweight_delete_rebuild_normal_projection (ClickHouse#118375). 05401 is free on master. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…er-projection-partial-mutation In `MutationsInterpreter::prepare`, this branch moved the rebuild of broken and missing commit-order projections into an earlier block that also reads their columns. Master (ClickHouse#123185) added `hasUnloadedProjection` to the projection loop. The loop now skips a projection the part does not have unless it is on disk but not loaded and is not a commit-order projection. Commit-order projections are already handled by the earlier block. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #111809
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
A mutation that rewrites only some columns of a Wide part now builds a missing commit-order projection (
allow_commit_order_projection) and a broken projection from the part's real values instead of type defaults, and no longer fails on every retry withNO_SUCH_COLUMN_IN_TABLEfor_block_number.Description
A part has no commit-order projection after an insert, so
MutationsInterpreterrebuilds it in every mutation, but, unlikeMATERIALIZE PROJECTION, without adding the projection's columns to the dependencies. A partial mutation of a Wide part did not read them, andPartMergerWriter::calculateProjectionfilled them with type defaults:_block_number(after a merge, a lightweightDELETEorATTACH PARTITION ... FROM),getPhysicalthrewNO_SUCH_COLUMN_IN_TABLEand the mutation was retried forever.A broken projection is rebuilt by every mutation the same way: a plain one got the defaults and returned wrong rows, a commit-order one hit the same error, one with none of its columns read was dropped.
The fix registers the required columns of both as readonly
PROJECTIONdependencies, asMATERIALIZE PROJECTIONdoes. The setting is experimental and broken projections come from damaged parts, hence Improvement.A projection already written with defaults stays wrong until dropped and re-added: merges keep it. A rebuilt projection still keeps lightweight-deleted rows; #111809 fixes that.
05340covers level-0, merged, attached and lightweight-deleted parts andMATERIALIZE PROJECTIONof another projection;05342breaks a plain and a commit-order projection. All fail without the fix.Server log on master (UPDATE after OPTIMIZE FINAL and ADD PROJECTION)
With the fix the same mutation logs
Will rebuild commit-order projection p2, writesp2and finishes.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/124912]