Skip to content

Add test: Lightweight UPDATE/DELETE materialization of _block_number/_block_offset on an upgraded table (MutateSomePartColumns path) is untested - #112379

Merged
PedroTadim merged 2 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr109281
Jul 29, 2026
Merged

PedroTadim merged 2 commits into
ClickHouse:masterfrom
clickgapai:qa-bot/coverage-pr109281

Conversation

@clickgapai

@clickgapai clickgapai commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Found via ClickGap automated review. Please close or comment if this is incorrect or needs adjustment.

This is a test-only PR — no source code changes. Please review: test quality, whether the claimed coverage gaps are real, and whether test output makes sense.

Adds test coverage for 1 untested code path(s), found during automated review of PR #109281.
That PR The PR fixes materialization of _block_number / _block_offset columns and their part-level min-max index across merges and mutations. (1) MergeTask::ExecuteAndFinalizeHorizontalPart::prepare now passes WITH_BLOCK_NUMBER_OFFSET to getMinMaxColumns only when both block columns are enabled (`

1. Lightweight UPDATE/DELETE materialization of _block_number/_block_offset on an upgraded table (MutateSomePartColumns path) is untested
src/Storages/MergeTree/MutateTask.cpp:753, src/Storages/MergeTree/MutateTask.cpp:630
Risk: splitAndModifyMutationCommands (MutateTask.cpp:630-640) appends READ_COLUMN commands for the block columns when !for_interpreter.empty() and the part lacks them, and getColumnsForNewDataPart (MutateTask.cpp:753-754) keeps them when updated_header.has(name). The PR's own tests only reach these branches through REWRITE PARTS, which forces the MutateAllPartColumnsTask path; a plain UPDATE/DELETE of a non-key column on a wide part takes the else branch at MutateTask.cpp:3667 …
What's unique vs PR tests: The PR's 04501 reaches block-column materialization only through REWRITE PARTS, which forces MutateAllPartColumnsTask, and asserts existence only. Existing block-column mutation tests (02668, 03001, 03275) enable the settings AT CREATE, so the part always already has the columns and the new !part_columns.has(...) materialization branch never fires. This test is the only one that upgrades an existing table (MODIFY SETTING) and then runs a lightweight UPDATE (non-key column, wide part …
Tags: -- Tags: no-random-settings, no-random-merge-tree-settings, no-shared-merge-tree — no-random-settings: test pins mutation version in generated part names (all_1_1_0_3); randomized settings can add extra mutations and shift versions; no-random-merge-tree-settings: test explicitly sets enable_block_number_column/enable_block_offset_column/min_bytes_for_wide_part; randomization would override them; no-shared-merge-tree: part naming and materialization differ under shared-merge-tree, breaking the parts_columns assertion

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)

Version info

  • Merged into: 26.8.1.365 (included in 26.8 and later)

@clickgapai

Copy link
Copy Markdown
Contributor Author

Pre-PR Validation Gate (per ClickGap pipeline):

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

b) Root cause explained? ✅
MutateTask.cpp:753-754 else if (name == BlockNumberColumn::name || name == BlockOffsetColumn::name) need_column = part_columns.has(name) || updated_header.has(name); combined with MutateTask.cpp:630-640 READ_COLUMN injection — both new branches are reached from the MutateSomePartColumnsTask task only via the untested upgrade+lightweight-mutation scenario.

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: 04652_mutation_materialize_block_columns_some.sql.

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.

@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Jul 29, 2026
@PedroTadim PedroTadim self-assigned this Jul 29, 2026
@PedroTadim
PedroTadim enabled auto-merge July 29, 2026 08:47
@clickhouse-gh

clickhouse-gh Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ad28098]

Summary: ✅


AI Review

Summary

This PR adds a focused stateless regression test for the upgraded-table mutation path that materializes _block_number and _block_offset into legacy Wide parts. After the follow-up change that pins the active part set with max_bytes_to_merge_at_max_space_in_pool = 1, I do not see any remaining correctness, flakiness, or coverage problems in the current diff.

Final Verdict

✅ No new findings.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Jul 29, 2026
@PedroTadim
PedroTadim disabled auto-merge July 29, 2026 09:08
@PedroTadim
PedroTadim enabled auto-merge July 29, 2026 09:28
@PedroTadim
PedroTadim added this pull request to the merge queue Jul 29, 2026
Merged via the queue into ClickHouse:master with commit d8d739f Jul 29, 2026
180 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 29, 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 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