Skip to content

Fix NOT_FOUND_COLUMN_IN_BLOCK on a vertical merge of a table with a move or recompression TTL - #121536

Merged
murphy-4o merged 2 commits into
ClickHouse:masterfrom
murphy-4o:vertical-ttl-merge-missing-ttl-columns
Sep 24, 2026
Merged

murphy-4o merged 2 commits into
ClickHouse:masterfrom
murphy-4o:vertical-ttl-merge-missing-ttl-columns

Conversation

@murphy-4o

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

Copy link
Copy Markdown
Member

Closes: #121531

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):

Fixed NOT_FOUND_COLUMN_IN_BLOCK when merging a table that has a rows TTL together with a move (TO DISK, TO VOLUME) or recompression (RECOMPRESS) TTL over a different column.


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

Version info

  • Merged into: 26.10.1.559-master (included in 26.10 and later)
  • Backported to: 26.9.37.6, 26.8.45.5, 26.3.70.5

A vertical merge runs the TTL step over the merged block, and that step
builds a `TTLUpdateInfoAlgorithm` for every move and recompression TTL.
Only the rows and rows-`WHERE` TTL expression columns were placed into
the merged stream, so a move or recompression TTL over any other column
was missing from the block: `OPTIMIZE ... FINAL` threw
`NOT_FOUND_COLUMN_IN_BLOCK` and the parts never merged, leaving their
expired rows in place.

Place the expression columns of every TTL the step evaluates.

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

clickhouse-gh Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [fae2364]

Summary: ❌

job_name test_name status info comment
Performance Comparison (arm_release, master_head, 1/6) FAIL Performance dashboard
optimize_time_filter_with_preimage #6 FAIL dashboard IGNORED
Performance Comparison (arm_release, master_head, 2/6) FAIL Performance dashboard
order_by_read_in_order #1 FAIL dashboard IGNORED
set_index #0 unstable query history IGNORED
Performance Comparison (arm_release, master_head, 3/6) FAIL Performance dashboard
read_in_reverse_order_final #0 FAIL dashboard IGNORED
file_table_function #7 unstable query history IGNORED
file_table_function #16 unstable query history IGNORED
file_table_function #17 unstable query history IGNORED
file_table_function #22 unstable query history IGNORED
iceberg_suite_rw_features #9 unstable query history IGNORED
polymorphic_parts_m #0 unstable query history IGNORED

AI Review

Summary

This PR fixes the vertical rows-TTL merge path so that the post-merge TTLStep also receives columns referenced by move and recompression TTL expressions. The change matches the failure mode described in #121531, and the new stateless test exercises both affected TTL families on a vertical merge. I did not find a correctness, coverage, or PR-metadata issue in the current diff.

Final Verdict

✅ No blocking issues found.

LLVM Coverage Report

Measured on commit fae2364.

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

Changed lines: Changed C/C++ lines covered: 11/11 (100.00%) · 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 22, 2026
@murphy-4o
murphy-4o marked this pull request as ready for review September 22, 2026 11:18
@clickhouse-gh

clickhouse-gh Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit fae236438742ae567c2ff1a2f32bb0d6571316b4 was not compared: the CI logs cluster did not answer (every POST attempt failed with an exception).

See the job log for details.

@Diskein Diskein left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change is LGTM, let's fix a test

BTW I've noticed that TTLStep still adds TTLDeleteTransformAlgorithm which again reads the columns which are already filtered by prescending transformers , maybe it is worth to use TTLUpdateInfoAlgorithm for the columns which will be processed by TTLDeleteFilterTransform?

@clickhouse-gh clickhouse-gh Bot added the comp-ttl TTL rules and TTL merges (moving/recompressing/rolling-up/deleting parts). label Sep 22, 2026
It moves to disk `default`, which an object-storage policy does not have, so
`CREATE TABLE` fails there with `BAD_TTL_EXPRESSION`. Tag it like
`01070_mutations_with_dependencies`, the other test with this construct; the
bug it covers does not depend on the storage.

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

Copy link
Copy Markdown
Member Author

The change is LGTM, let's fix a test

BTW I've noticed that TTLStep still adds TTLDeleteTransformAlgorithm which again reads the columns which are already filtered by prescending transformers , maybe it is worth to use TTLUpdateInfoAlgorithm for the columns which will be processed by TTLDeleteFilterTransform?

sounds good.
but i found a behavior difference between them and it might be bug:

  • TTLUpdateInfoAlgorithm ignores the WHERE, while TTLDeleteAlgorithm consider it, which means they will generate different ttl_info
  • it doesn't affect the correctness but affect the schedule behavior which is based on the ttl_info
  • i may need to align the behavior of it before switching to TTLUpdateInfoAlgorithm

@Diskein Diskein self-assigned this Sep 23, 2026
@Diskein

Diskein commented Sep 23, 2026

Copy link
Copy Markdown
Contributor
  • TTLUpdateInfoAlgorithm ignores the WHERE, while TTLDeleteAlgorithm consider it, which means they will generate different ttl_info

True, maybe it worth a separate PR with a fix.

IMHO it should have used common logic, e.g. TTLDeleteAlgorithm could pass a block to TTLUpdateInfo algorithm or just shared common structure, or should be execute one after another.

@murphy-4o
murphy-4o removed the request for review from alesapin September 23, 2026 12:21
@murphy-4o
murphy-4o added this pull request to the merge queue Sep 24, 2026
Merged via the queue into ClickHouse:master with commit f61f67b Sep 24, 2026
172 of 176 checks passed
@murphy-4o
murphy-4o deleted the vertical-ttl-merge-missing-ttl-columns branch September 24, 2026 02:24
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Sep 24, 2026
@murphy-4o murphy-4o added the pr-must-backport Pull request should be backported intentionally. Use this label with great care! label Nov 23, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR labels Nov 23, 2026
clickhouse-gh Bot added a commit that referenced this pull request Nov 23, 2026
Backport #121536 to 26.9: Fix NOT_FOUND_COLUMN_IN_BLOCK on a vertical merge of a table with a move or recompression TTL
clickhouse-gh Bot added a commit that referenced this pull request Nov 23, 2026
Backport #121536 to 26.8: Fix NOT_FOUND_COLUMN_IN_BLOCK on a vertical merge of a table with a move or recompression TTL
murphy-4o added a commit that referenced this pull request Nov 23, 2026
Backport #121536 to 26.3: Fix NOT_FOUND_COLUMN_IN_BLOCK on a vertical merge of a table with a move or recompression TTL
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 fails with NOT_FOUND_COLUMN_IN_BLOCK on a move or recompression TTL column

4 participants