Fixbug merge tree reader rows incorrect#90254
Merged
scanhex12 merged 4 commits intoClickHouse:masterfrom Nov 19, 2025
Merged
Conversation
… contains fewer rows than index_granularity
Contributor
|
Workflow [PR], commit [8901c4b] Summary: ❌
|
scanhex12
approved these changes
Nov 18, 2025
Merged
via the queue into
ClickHouse:master
with commit Nov 19, 2025
99a5e6f
125 of 132 checks passed
This was referenced Nov 19, 2025
robot-clickhouse-ci-2
added a commit
that referenced
this pull request
Nov 19, 2025
Cherry pick #90254 to 25.11: Fixbug merge tree reader rows incorrect
robot-clickhouse
added a commit
that referenced
this pull request
Nov 19, 2025
clickhouse-gh bot
added a commit
that referenced
this pull request
Nov 19, 2025
Backport #90254 to 25.11: Fixbug merge tree reader rows incorrect
Member
|
@scanhex12 The backport PRs are unmerged since two weeks. Could I ask you to take care of them please? Thanks - |
Member
|
@scanhex12 The backport PRs are unmerged since three weeks. Could I ask you to take care of them please? Thanks - |
Member
|
@scanhex12 The backport PRs are unmerged since four weeks. Could I ask you to take care of them please? Thanks - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixes a row-count mismatch in MergeTreeReaderIndex when the part's only has fewer rows than index_granularity. Resolves #89691
Details
When a part consists of only one granule, and its total number of rows is less than the configured index_granularity, the current implementation of MergeTreeReaderIndex unconditionally returns index_granularity rows.
The subsequent reader in the chain (e.g., MergeTreeReader) then reads the actual number of rows from the part.
This discrepancy leads to a mismatch during the continueReadingChain consistency check and triggers a LOGICAL_ERROR.
How to reproduce it?
https://fiddle.clickhouse.com/73b7c1a9-ec7f-462e-9e79-b507e1b2b948
I previously opened a PR #89555 that mixed fixes for two different bugs. I'm splitting them now and will submit separate PRs for each one.