Skip to content

Fix LOGICAL_ERROR in ReplacingMergeTree variants on empty block after insert deduplication - #127439

Merged
antaljanosbenjamin merged 2 commits into
masterfrom
fix-merge-block-empty-input
Oct 24, 2026
Merged

antaljanosbenjamin merged 2 commits into
masterfrom
fix-merge-block-empty-input

Conversation

@antaljanosbenjamin

@antaljanosbenjamin antaljanosbenjamin commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

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 a logical error when insert deduplication removes all rows of a partition block before it is merged on insert into a ReplacingMergeTree or another special MergeTree engine, e.g. when coalesced async inserts with the same insert deduplication token push to a partitioned materialized view target.


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

Version info

  • Merged into: 26.11.1.731-master (included in 26.11 and later)
  • Backported to: 26.10.3.3, 26.9.26.16, 26.8.35.13, 26.3.61.12

@clickhouse-gh

clickhouse-gh Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [46eb270]

Summary: ✅


AI Review

Summary

The PR makes MergeTreeDataWriter::mergeBlock preserve empty input blocks, preventing a LOGICAL_ERROR when insert deduplication removes every row of a partition before insert-time merging. It adds a focused async-insert/materialized-view regression test, which passes in Fast test. No actionable findings in the current diff.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Oct 22, 2026
@alesapin alesapin self-assigned this Oct 22, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. label Oct 22, 2026
@watson-ch

watson-ch Bot commented Oct 22, 2026

Copy link
Copy Markdown

Backport labels have been automatically added based on https://github.com/clickhouse/clickhouse-core-incidents/issues/1944

Labels added:

  • v26.2-must-backport
  • v26.4-must-backport
  • v26.6-must-backport
  • v26.8-must-backport

These labels ensure backport PRs are properly created for each affected release version. The release automation will create backport PRs as needed based on these labels.

@clickhouse-gh

clickhouse-gh Bot commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 46eb270fe with master 68d2bfb07 (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, 17 s compile time in total, 7 of them have a recent master baseline.

Job report

@antaljanosbenjamin
antaljanosbenjamin added this pull request to the merge queue Oct 24, 2026
Merged via the queue into master with commit e9699fe Oct 24, 2026
178 checks passed
@antaljanosbenjamin
antaljanosbenjamin deleted the fix-merge-block-empty-input branch October 24, 2026 08:51
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Oct 24, 2026
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Oct 24, 2026
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 24, 2026
clickhouse-gh Bot added a commit that referenced this pull request Oct 24, 2026
Backport #127439 to 26.10: Fix `LOGICAL_ERROR` in ReplacingMergeTree variants on empty block after insert deduplication
clickhouse-gh Bot added a commit that referenced this pull request Oct 24, 2026
Backport #127439 to 26.9: Fix `LOGICAL_ERROR` in ReplacingMergeTree variants on empty block after insert deduplication
clickhouse-gh Bot added a commit that referenced this pull request Oct 24, 2026
Backport #127439 to 26.8: Fix `LOGICAL_ERROR` in ReplacingMergeTree variants on empty block after insert deduplication
groeneai added a commit to groeneai/ClickHouse that referenced this pull request Oct 24, 2026
…ge-row-selecting-gather

Resolves the conflict in MergeTreeDataWriter::mergeBlock with the empty-block early return from ClickHouse#127439: it stays first, so an empty block never reaches the skip or the key-column merge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
alexey-milovidov added a commit that referenced this pull request Oct 25, 2026
Backport #127439 to 26.3: Fix `LOGICAL_ERROR` in ReplacingMergeTree variants on empty block after insert deduplication
leshikus pushed a commit that referenced this pull request Nov 13, 2026
…ariants on empty block after insert deduplication
leshikus pushed a commit that referenced this pull request Nov 13, 2026
…ariants on empty block after insert deduplication
leshikus pushed a commit that referenced this pull request Nov 13, 2026
…ariants on empty block after insert deduplication
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. 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-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.2-must-backport v26.4-must-backport v26.6-must-backport v26.8-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants