Repository navigation
Remove redundant automatic_parallel_replicas_mode = 0 overrides from tests - #116540
Merged
Merged
Conversation
`clickhouse-test` randomizes `automatic_parallel_replicas_mode` to 2 in a quarter of the runs. A test that turns parallel replicas on has to pin the setting back to 0, because `InterpreterSelectQueryAnalyzer` resolves the combination by switching `enable_parallel_replicas` off - without the pin such a test silently stops using parallel replicas while still passing. The pin has since been copied into tests that never turn parallel replicas on. There it cannot do anything: automatic parallel replicas require `enable_parallel_replicas != 0`, and each of these tests already keeps it at 0 - in the same statement, through the `no-parallel-replicas` tag (which makes `clickhouse-test` append `--enable_parallel_replicas 0`), or through `make_distributed_plan`, where `adjustSettingsForMakeDistributedPlan` resets both settings anyway. Drop the override in those tests and keep every `enable_parallel_replicas = 0`, which is what actually keeps the feature off. Two tests change slightly more: - `03031_filter_float64_logical_error` had the `SET` after its last query. - `03164_selects_with_pk_usage_profile_event` also drops `enable_parallel_replicas = 0`: the profile events it asserts on now come out the same with automatic and with regular parallel replicas. Every modified test was run 10 times in each of three configurations: the settings the randomizer applies for `automatic_parallel_replicas_mode = 2`, the settings of the `ParallelReplicas` run, and the default randomized run. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SCG1SmbEFstcpdE5es5z9P
They belong to unrelated work in progress in this worktree. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SCG1SmbEFstcpdE5es5z9P
`01666_merge_tree_max_query_limit` and `03394_distributed_shuffle_join` need MinIO, which the local run of the previous commit did not have, so they were left out of it. Both keep `enable_parallel_replicas = 0` next to the removed setting, which is what actually keeps automatic parallel replicas from running. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SCG1SmbEFstcpdE5es5z9P
These tests carried the `no-parallel-replicas` tag and set `enable_parallel_replicas = 0` because parallel replicas reshaped the plan and added query condition cache lookups their assertions did not expect. That is no longer the case: they hold both with the automatic parallel replicas probe running (`automatic_parallel_replicas_mode = 2`, what the test runner randomizes) and with parallel replicas actually reading. Drop the tag and the override so the `ParallelReplicas` run and the randomized runs cover them. `03518_key_condition_binary_search` keeps a guard, a narrower one: the ProfileEvents it asserts on are only collected for the part of the query the coordinator runs itself, so it pins `parallel_replicas_local_plan` rather than switching parallel replicas off. The other tests pin that setting already. Each test was run 5 times in each of four configurations: the settings the runner applies for `automatic_parallel_replicas_mode = 2`, the settings of the `ParallelReplicas` run, the same with `parallel_replicas_local_plan = 0`, and the default randomized run. The runs did exercise both paths - the probe fired and the replicas ran their own queries. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SCG1SmbEFstcpdE5es5z9P
Contributor
|
Workflow [PR], commit [92e10bd] Summary: ✅ AI ReviewSummaryThis PR removes redundant Final Verdict✅ No actionable findings. |
The test lists query shapes the automatic parallel replicas optimization does not support, but it ran them with `enable_parallel_replicas = 0`, and with parallel replicas off the heuristic is skipped outright - so none of the shapes reached it. Turn parallel replicas on and state what "unsupported" means: the query completes and no dataflow statistics are collected for it, that is `RuntimeDataflowStatisticsInputBytes` and `RuntimeDataflowStatisticsOutputBytes` both stay at zero. Supporting one of the shapes now makes its counters non-zero and fails the test, which is the signal to move the case out of this list. `pointInPolygon` over a scalar subquery is supported today - it collects the whole 4 MB of the table as input bytes - so it is dropped from the list together with the table it needed. One supported query stays as a control, so that a change which stops the optimization from running at all fails here instead of making every case pass trivially. Ran 20 times: 10 with the default randomization, 5 with the settings the runner applies for `automatic_parallel_replicas_mode = 2`, 5 with the settings of the `ParallelReplicas` run. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SCG1SmbEFstcpdE5es5z9P
…move-autopr-test-pins
…part The case was `SELECT * FROM t lhs INNER JOIN t rhs ON ... LIMIT 1`, and it is the `LIMIT`, not the join, that the optimization gives up on: the preliminary `LIMIT` puts a `Limit` step on top of the read from the other replicas, and `findTopNodeOfReplicasPlan` only looks through `Expression`, `Filter` and `CreatingSets` steps, so it does not recognize that branch of the `Union` and reports "Top node for parallel replicas plan is already found". `SELECT * FROM t LIMIT 1` reproduces it without a join. The same join without the `LIMIT` is supported and collects 4 MB in / 8 MB out, so replace the case with the `LIMIT` one and keep the join as a second control. The join control pins `query_plan_optimize_join_order_randomize`: the single-node plan and the plan with parallel replicas are built independently, so a randomized join order makes them diverge and no matching node is found - that knob is off by default and only the test runner turns it on. Ran 30 times on the final version: 20 with the default randomization, 5 with the settings the runner applies for `automatic_parallel_replicas_mode = 2`, 5 with the settings of the `ParallelReplicas` run. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SCG1SmbEFstcpdE5es5z9P
The flaky checks caught the `min` case: `min(a)` over the primary key is answered by the implicit `minmax_count` projection, which is what makes the plan read nothing and gives the `ReadFromPreparedSource` step the optimization rejects. The test runner randomizes `optimize_use_projections` and `optimize_use_implicit_projections`, and with either of them off the same query reads the column, collects statistics and the case stops being unsupported - the 13 failures all showed exactly that, ~400 KB of input bytes instead of zero. Pin both settings and rename the case after what it actually exercises. https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=116540&sha=b002858c7107e5c7627082cf0f9ca7931f35cbeb&name_0=PR #116540 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SCG1SmbEFstcpdE5es5z9P
…ent` Removing `enable_parallel_replicas = 0` from this test was wrong. It does not opt out of randomized settings, and in the `ParallelReplicas` run parallel replicas are on for plain MergeTree from the profile while `parallel_replicas_local_plan` is randomized. With no local plan the reads happen on the replicas, so `SelectQueriesWithPrimaryKeyUsage` is reported by their queries and not by the initial one this test reads from `system.query_log`, and the expected `1`s become `0`s. Reproduced 3 times out of 3 locally with those settings. The setting comes back with the reason written down. The automatic mode override stays removed: it cannot do anything while parallel replicas are off. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01SCG1SmbEFstcpdE5es5z9P
nickitat
commented
Aug 27, 2026
Member
Author
There was a problem hiding this comment.
This test was reworked: now we will immediately notice when an unsupported case became supported, and will flip the expected result.
nickitat
marked this pull request as ready for review
August 27, 2026 10:52
pull Bot
pushed a commit
to admariner/ClickHouse
that referenced
this pull request
Aug 31, 2026
The automatic parallel replicas optimization runs over the query plan, and only the analyzer builds one - `InterpreterSelectQuery` turns `enable_parallel_replicas` off as soon as it sees `enable_parallel_replicas` together with a non-zero `automatic_parallel_replicas_mode`. So with the old analyzer the two `supported_*` shapes added in ClickHouse#116540 collect no dataflow statistics either and print `0 0`, which fails the test deterministically in the old-analyzer job. Every other `*_autopr_*` test already pins `enable_analyzer=1`; do the same here. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=828b3cd06ccd76999a396db1451d3eb3f24325cc&name_0=MasterCI&name_1=Stateless%20tests%20(amd_llvm_coverage%2C%20old%20analyzer%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F3) Caused by: ClickHouse#116540 Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017SM8hLHmtt2vngrfB7758u
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):
Workflow [PR]
Sync PR [sync-upstream/pr/116540]