Fix coordination mode mismatch for parallel replicas with aggregation in order#98467
Open
alexey-milovidov wants to merge 2 commits intomasterfrom
Open
Fix coordination mode mismatch for parallel replicas with aggregation in order#98467alexey-milovidov wants to merge 2 commits intomasterfrom
alexey-milovidov wants to merge 2 commits intomasterfrom
Conversation
… in order When the initiator replica has no parts to read, `result.read_type` remains `Default` (never updated to `InOrder`), but `query_info.input_order_info` is set with direction=1 by the `optimizeAggregationInOrder` optimization. The coordination mode calculation incorrectly used `result.read_type` to determine the mode, falling into the `ReverseOrder` branch for non-`InOrder` read types. Meanwhile, the remote replica with actual data correctly computed `WithOrder` (direction=1), causing the coordinator to throw: "Replica 0 decided to read in WithOrder mode, not in ReverseOrder." Fix by using `query_info.input_order_info->direction` directly, which is always consistent regardless of whether `result.read_type` was updated. Also enable `parallel_replicas_filter_pushdown` in the existing test for this issue. https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=03c7c3d6f2c843cd5f0f681e5032bf968e97e88a&name_0=MasterCI&name_1=AST%20fuzzer%20%28amd_debug%29 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
|
Workflow [PR], commit [839544f] Summary: ❌
|
Revert modification to the existing test `03810_pr_aggr_in_order_read_mode` and add a new test `04009_pr_aggr_in_order_coordination_mode` that covers the fix with `parallel_replicas_filter_pushdown` enabled. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
optimize_aggregation_in_orderandparallel_replicas_local_plan.result.read_type(Default) to compute coordination mode, incorrectly mapping toReverseOrder, while remote replicas correctly computedWithOrderfrominput_order_info->direction.query_info.input_order_info->directiondirectly, which is always consistent regardless of whether range analysis ran.Fixes #95524
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=03c7c3d6f2c843cd5f0f681e5032bf968e97e88a&name_0=MasterCI&name_1=AST%20fuzzer%20%28amd_debug%29
Test plan
03810_pr_aggr_in_order_read_modepasses with the fixparallel_replicas_filter_pushdown = 1enabled (previously had a TODO to enable after fix)Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix logical error exception "Replica decided to read in WithOrder mode, not in ReverseOrder" when using parallel replicas with
optimize_aggregation_in_order.🤖 Generated with Claude Code