Repository navigation
Cherry pick #125801 to 26.9: Parallel replicas followers follow the initiator whatever their own automatic_parallel_replicas_mode - #129267
Conversation
…utomatic_parallel_replicas_mode `Context::canUseTaskBasedParallelReplicas` requires `automatic_parallel_replicas_mode == 0`, and `canUseParallelReplicasOnFollower` is that predicate plus `collaborate_with_initiator`. The initiator ships `automatic_parallel_replicas_mode = 0` to its followers, but the value does not always arrive: - under `allow_feature_tier = 1`, `TCPHandler::receiveQuery` applies a secondary query's settings through `clampToSettingsConstraints`, which silently drops the change of this EXPERIMENTAL setting, so the follower keeps the mode from its profile; - the INSERT's own `SETTINGS automatic_parallel_replicas_mode = 2` is part of the shipped query text and is re-applied on the follower (#121734). Such a follower refused to collaborate and read its whole table. A SELECT is saved by the coordinator cancelling unused replicas once every range is assigned, at the cost of N times the work; a distributed INSERT SELECT has no such cancel, so every follower inserted its whole source table again (3x rows on a 3-replica cluster). The automatic mode is a decision of the initiator. On a follower `canUseTaskBasedParallelReplicas` now ignores it (the private impl's flag already exists for cluster engines), and so does `isParallelReplicasEnabled`, so every follower-side answer equals the answer for mode 0, i.e. what it already was when the shipped value arrived. Changing the base predicate, not only `canUseParallelReplicasOnFollower`, keeps the follower-side direct callers (planner checks, view metadata propagation) consistent within one query. Initiator contexts are unchanged. New integration test `test_parallel_replicas_feature_tier`: a distributed INSERT SELECT (300000 rows instead of 100000 before the change) and the heuristic SELECT with unused replicas kept alive by `parallel_replicas_wait_for_unused_replicas` (every group counted 3 times before the change). Closes #125757 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ture_tier The row count alone is also satisfied when the INSERT SELECT falls back to the local pipeline (`buildInsertSelectPipelineParallelReplicas` returning nothing), so the test would keep passing without any follower having run. Count the non-initial `Insert` queries of the INSERT in `system.query_log` on all replicas: node1 runs its share in the local plan, node2 and node3 run the shipped INSERT. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Condense the follower comment in Context::canUseTaskBasedParallelReplicas to one line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-automatic-mode Parallel replicas followers follow the initiator whatever their own `automatic_parallel_replicas_mode`
|
The conflict is in code that does not exist on 26.9: #125801 edits On the 26.9 tree (clang-22, debug) I cannot push to |
|
@copilot resolve the merge conflicts in this pull request |
… into cherrypick/26.9/125801 # Conflicts: # src/Interpreters/Context.cpp # src/Interpreters/Context.h # src/Interpreters/InterpreterSelectQueryAnalyzer.cpp Co-authored-by: nickitat <[email protected]>
|
|
f447efc
into
backport/26.9/125801
🕵 Resolved the 26.9 conflicts in merge commit |
Original pull-request #125801
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