Repository navigation
Cherry pick #126792 to 26.10: Apply skip indexes at analysis time on tables with max_partitions_to_read - #127243
Merged
Merged
Conversation
`max_partitions_to_read` is checked in `ReadFromMergeTree::initializePipeline`, before the read. With `use_skip_indexes_on_data_read = 1` the index analysis leaves skip indexes to the read, so parts a skip index would drop still count against the limit, and a query that relies on a skip index to stay under it fails with `TOO_MANY_PARTITIONS` on a cold query condition cache. This was hidden when parallel replicas were enabled with `parallel_replicas_min_number_of_rows_per_replica > 0`: the planner's row estimate ran a full analysis with skip indexes first and filled the query condition cache. Automatic parallel replicas analyze the executed read before that estimate (or skip it), which exposed the failure. Treat `max_partitions_to_read` like `max_rows_to_read` with `read_overflow_mode = 'throw'` in `supportsSkipIndexesOnDataRead`: skip indexes are applied during index analysis when the limit is set. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nalysis With `parallel_replicas_local_plan = 1` and `parallel_replicas_index_analysis_only_on_coordinator = 1` a follower skips index analysis and keeps every part, leaving range assignment to the coordinator. `checkLimits` then counted those parts against `max_partitions_to_read`, so the follower failed with `TOO_MANY_PARTITIONS` even though the coordinator pruned the read to fewer partitions. The initiator tolerated the failed replica, which silently lost its share of the work. The initiator still checks the limit on the coordinator's analysis. The test now disables the row limits of the test profile, which already turned read-time skip indexes off and made it pass without the fix, and the query condition cache, so earlier queries cannot prune the parts for later ones. It also covers the follower case. Addresses the AI review: #126792 (comment) Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # src/Processors/QueryPlan/ReadFromMergeTree.cpp # src/Processors/QueryPlan/ReadFromMergeTree.h
…_done_on_initiator` The old name read like a mirror of `parallel_replicas_index_analysis_only_on_coordinator`, while the field is set only on a follower that skipped its own analysis. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… plan A follower skipped its own index analysis whenever `parallel_replicas_local_plan` was set, but the initiator builds no local plan with `parallel_replicas_prefer_local_replica = 0`, inside a `Distributed` sub-query, or when the leaf timeout disables it. Then nobody analyzed the indexes, and since the previous commit nobody checked `max_partitions_to_read` either: a remote-only parallel read went past the limit. Use `ClusterProxy::canUseLocalPlanForParallelReplicas`, which decides whether the initiator runs a local plan, so in the other cases the followers analyze and check the limit themselves. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Apply skip indexes at analysis time on tables with `max_partitions_to_read`
Member
|
@copilot resolve the merge conflicts in this pull request |
Co-authored-by: nickitat <[email protected]>
|
|
Contributor
🕵 Resolved and pushed in |
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.
Original pull-request #126792
Do not merge this PR manually
This pull-request is a first step of an automated backporting.
It contains changes similar to calling
git cherry-picklocally.If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.
The check results does not matter at this step - you can safely ignore them.
Before you resolve anything
Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.
Troubleshooting
If the conflicts were resolved in a wrong way
If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:
pr-cherrypicklabel from the PRYou also need to check the Original pull-request for
pr-backports-createdlabel, and delete if it's presented thereThe PR source
The PR is created in the CI job