Skip to content

Fix vertical TTL delete merge failing when the rows TTL reads a column no part stores - #122164

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
murphy-4o:merge-ttl/fix/vertical-ttl-delete-missing-input
Oct 22, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
murphy-4o:merge-ttl/fix/vertical-ttl-delete-missing-input

Conversation

@murphy-4o

@murphy-4o murphy-4o commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Closes: #121960
Related: #97332

When a rows TTL reads a column that no source part stores, the merge chooses a vertical TTL delete.
TTLDeleteFilterTransform then evaluates the TTL on the merge input before anything has filled the
column, and the merge fails with NOT_FOUND_COLUMN_IN_BLOCK on every retry, so the parts never merge.

This exists since 26.3, where vertical_merge_optimize_ttl_delete is on by default.

The case of a column that no source part stores: one added by ALTER TABLE ... ADD COLUMN without
a default and never written, and the parts' TTL is not calculated yet (MODIFY TTL with
materialize_ttl_after_modify = 0, or parts attached from before the column existed).

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fix merges failing with NOT_FOUND_COLUMN_IN_BLOCK on every retry when a rows TTL reads a column that no part stores yet.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/122164]

Version info

  • Merged into: 26.11.1.596-master (included in 26.11 and later)
  • Backported to: 26.10.2.88, 26.9.26.6, 26.8.35.4, 26.7.38.11, 26.3.60.3

In a vertical TTL-delete merge, `TTLDeleteFilterTransform` evaluates the rows
TTL before the merge, but only `TTLTransform`, after the merge, fills a column
that no source part stores. If the TTL reads such a column and the parts' TTL
is not calculated yet (`MODIFY TTL` with `materialize_ttl_after_modify = 0`, or
parts attached from before the column existed), the merge failed with
`NOT_FOUND_COLUMN_IN_BLOCK` on every retry. `canVerticalTTLDelete` now rejects
such a TTL, so the merge goes horizontal and fills the column first.

Also explain what `IMergeTreeDataPart::expired_columns` holds.

Fixes ClickHouse#121960.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d312777]

Summary: ✅


AI Review

Summary

This PR makes MergeTask fall back to a horizontal merge when vertical TTL delete would evaluate a rows TTL before a physically absent column has been materialized, and it adds a focused stateless regression test that distinguishes the fallback case from a still-valid vertical TTL delete path. I did not find a correctness, coverage, or metadata issue in the current diff.

Final Verdict
  • Status: ✅ Approve

LLVM Coverage Report

Measured on commit d312777.

Metric Baseline Current Δ
Lines 88.10% 88.10% +0.00%
Functions 91.70% 91.70% +0.00%
Branches 79.40% 79.50% +0.10%

Changed lines: Changed C/C++ lines covered: 12/13 (92.31%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Sep 25, 2026
@murphy-4o murphy-4o added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Sep 25, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-ttl TTL rules and TTL merges (moving/recompressing/rolling-up/deleting parts). label Sep 25, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 25, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing d31277725 with master 68694750f (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

7 translation units recompiled, 23 s compile time in total, 7 of them have a recent master baseline.

Job report

@murphy-4o
murphy-4o marked this pull request as ready for review September 28, 2026 05:15
@alexey-milovidov alexey-milovidov self-assigned this Oct 22, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 22, 2026
Merged via the queue into ClickHouse:master with commit cc7a494 Oct 22, 2026
176 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Oct 22, 2026
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 22, 2026
@robot-clickhouse robot-clickhouse added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Oct 22, 2026
clickhouse-gh Bot added a commit that referenced this pull request Oct 23, 2026
Backport #122164 to 26.8: Fix vertical TTL delete merge failing when the rows TTL reads a column no part stores
clickhouse-gh Bot added a commit that referenced this pull request Oct 23, 2026
Backport #122164 to 26.9: Fix vertical TTL delete merge failing when the rows TTL reads a column no part stores
clickhouse-gh Bot added a commit that referenced this pull request Oct 23, 2026
Backport #122164 to 26.10: Fix vertical TTL delete merge failing when the rows TTL reads a column no part stores
clickhouse-gh Bot added a commit that referenced this pull request Oct 23, 2026
Backport #122164 to 26.7: Fix vertical TTL delete merge failing when the rows TTL reads a column no part stores
murphy-4o added a commit that referenced this pull request Oct 23, 2026
Backport #122164 to 26.3: Fix vertical TTL delete merge failing when the rows TTL reads a column no part stores
VighneshPath pushed a commit to VighneshPath/ClickHouse that referenced this pull request Nov 23, 2026
…ling when the rows TTL reads a column no part stores
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-ttl TTL rules and TTL merges (moving/recompressing/rolling-up/deleting parts). pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-bugfix Pull request with bugfix, not backported by default pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vertical TTL merge throws when the rows-TTL column is missing from all parts

4 participants