Skip to content

Add test: Absent-column skip for a part ahead of a MergeTree table is untested - #120817

Merged
alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr119354
Oct 27, 2026
Merged

alexey-milovidov merged 4 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr119354

Conversation

@clickgapai

@clickgapai clickgapai commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Test-only PR. Review: are the gaps real, is the test right.

Adds test coverage for 1 untested code path, found during automated review of PR #119354.
That PR: (1) splitAndModifyMutationCommands (MutateTask.cpp:565-574): when a Compact part carries a column the table does not have and the storage does not support replication, the column is now skipped instead of turned into a READ_COLUMN command, so the mutation rewrites the part without it. (2) …

1. Absent-column skip for a part ahead of a MergeTree table is untested
src/Storages/MergeTree/MutateTask.cpp:559, src/Storages/MergeTree/MutateTask.cpp:571
Risk: MutateTask::prepare -> MutationHelpers::splitAndModifyMutationCommands (confirmed call edge, MutateTask.cpp:4112). For a Compact part, every part column the mutation does not touch becomes a READ_COLUMN command; a column absent from the table is first tested against part_metadata_version … **Unique vs PR tests:** The PR's 05202builds the equal-version case (part and table both at metadata version 0), which on current master returns atMutateTask.cpp:555` - verified from the server log message, which prints both versions. This test is the only one that makes the part's version ahead of the table's, …

cc @alexey-milovidov (author of #119354) — could you take a look, and add the can be tested label if this looks good?

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

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

Not applicable — test-only change.

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

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

Version info

  • Merged into: 26.11.1.823-master (included in 26.11 and later)

@clickgapai

Copy link
Copy Markdown
Contributor Author
Pre-PR validation: 6/6 ✅

a) Deterministic repro? ✅
Test exercises the previously-uncovered branch and passes (correct behaviour).

b) Root cause explained? ✅
src/Storages/MergeTree/MutateTask.cpp:571-574 - the LOG_WARNING + continue runs only when part_metadata_version > table_metadata_version and !part->storage.supportsReplication(). The PR's own test builds the equal-version case, which returns at :555 instead after < became <= in f22d208 (merged into master after this PR), so the branch has no test left.

c) Fix matches root cause? ✅
N/A for coverage gap — this PR adds a regression test, not a fix. Asserts current correct behaviour at the cited line.

d) Test intent preserved? / New tests added? ✅
New regression test added: 05227_mutate_part_ahead_of_table_metadata_version_mergetree.sh.

e) Both directions demonstrated? ✅
Test passes (MATCH) on master proving current correctness; would fail if the cited branch regressed. Single-direction is the correct shape for a coverage gap test.

f) Fix is general, not a narrow patch? ✅
Test asserts the invariant at the cited line — covers the branch, not a specific input shape.

@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Sep 18, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Sep 18, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [d5f312b]

Summary: ✅


AI Review

Summary

Adds a regression test for mutating a Compact part whose metadata version is ahead of a non-replicated MergeTree table and whose columns include a dropped column. The fixture reaches the intended branch, and its assertions cover the rewrite and mutation completion. No actionable findings; the new test passed in Fast test CI.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Sep 18, 2026
@clickgapai

Copy link
Copy Markdown
Contributor Author

CI check Style check failed, but the failure does not reference this PR's test (05227_mutate_part_ahead_of_table_metadata_version_mergetree).

This PR is test-only; the bot will not retrigger CI or modify the test to chase a failure that appears unrelated. If you believe a failure is related to this test, please comment with details and the bot will re-evaluate.

@alexey-milovidov alexey-milovidov self-assigned this Oct 25, 2026
alexey-milovidov and others added 3 commits October 26, 2026 11:41
…es, filter by `currentDatabase`

The test works on a private `clickhouse-local` directory, so locate the
`metadata_version.txt` files with `find` inside it instead of fetching the
paths from `system.parts`/`system.detached_parts`, which the style check
treats as server data manipulation. Also add `database = currentDatabase()`
to the queries to system tables.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`clickhouse-local` may leave outdated parts on disk, so finding every
non-detached `metadata_version.txt` matched more than one file. Take the
active part name from `system.parts` and find its file by name.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 The Style check failure was caused by this test: server_data_manipulation_in_stateless_tests (part paths fetched from system.parts/system.detached_parts plus chmod/redirect) and the database = currentDatabase() check. Fixed in the new commits: the test now locates metadata_version.txt with find inside its private clickhouse-local directory (active part matched by name, because outdated parts may still be on disk) and filters system tables by currentDatabase(). Also merged the latest master. Verified locally: the test passes 3/3 and both style checks are clean.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 26, 2026
Merged via the queue into ClickHouse:master with commit f38dc56 Oct 27, 2026
178 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 27, 2026
@clickhouse-gh clickhouse-gh Bot added comp-mutations ALTER UPDATE/DELETE and mutation execution over parts (including lightweight updates/deletes). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-mutations ALTER UPDATE/DELETE and mutation execution over parts (including lightweight updates/deletes). pr-not-for-changelog This PR should not be mentioned in the changelog 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.

3 participants