Repository navigation
Randomize parallel_replicas_min_number_of_rows_per_replica - #71028
devcrafter wants to merge 49 commits into
Conversation
|
Dear @antaljanosbenjamin, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
Dear @antaljanosbenjamin, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
Workflow [PR], commit [cd118cf] Summary: ✅
AI ReviewSummaryReviewed #71028 at The disposable plan is consumed by the Missing context / blind spots
Final VerdictStatus: ✅ Approve. No new inline findings or thread changes. Required CI checks must finish successfully before merge. |
|
@devcrafter, it shows errors. |
|
Dear @alexey-milovidov, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
@devcrafter, it failed. |
|
Dear @alexey-milovidov, this PR hasn't been updated for a while. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
|
@devcrafter, more changes are needed. |
|
🕵 Merged The merge brings in #121269 (class 1 and class 2: @groeneai, about #121301: I prefer (B). Cut it down to its regression test, because |
|
Done as (B): #121301 now contains only It does not duplicate existing coverage: no test on master combines I also added a per-arm check of |
…o-read-setting # Conflicts: # tests/queries/0_stateless/05043_distributed_alias_column_window_order.sql
|
🕵 Merged
@groeneai, thanks for cutting #121301 down to the The other reds are the same parallel-replicas bugs as before: |
|
🕵 The CI run on
The branch is up to date with |
…er dummy tables `collectFiltersForAnalysis` plans the query once more over dummy tables and optimizes that plan to collect the pushed-down filters. With `join_algorithm = 'direct'` the optimization tried to build a direct join with a `MergeTree` right table, whose read is a `ReadFromDummy` there, and threw `None of the algorithms enabled by the 'join_algorithm' setting [direct] can execute this ALL INNER JOIN`. The filter collection runs for `MergeTree` tables when `parallel_replicas_min_number_of_rows_per_replica` is positive, so randomizing that setting made `05211_pr_plan_based_direct_join_merge_tree` fail. The dummy plan is never executed, so use the `hash` algorithm there. Adjust the contexts of all nested queries and unions, not only the top-level one, because each of them is planned with its own context. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=71028&sha=e6a050daab862c05e6edc5947da0bc615b48ad12&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29 #71028 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… `04052` Both tests count the `mergeTreeAnalyzeIndexes` queries issued for a read. A positive `parallel_replicas_min_number_of_rows_per_replica` makes the planner estimate the rows to read before the read itself, and that estimate issues more index analysis queries, so the counts do not match. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=71028&sha=e6a050daab862c05e6edc5947da0bc615b48ad12&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29 #71028 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
`collectFiltersForAnalysis` forced `join_algorithm = 'hash'` to avoid `NOT_IMPLEMENTED` for a direct join over dummy tables. That broke valid queries which `hash` cannot execute, e.g. an inequality-only `ASOF JOIN` with `full_sorting_merge` over a `View` (the filter-collection plan runs for `View` even without parallel replicas). The plan is never executed, so keep joins logical instead (`keep_logical_steps`): no physical algorithm is chosen, and the filter push-down still happens before the conversion. Add the `ASOF JOIN` case to the regression test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…cker` stops it `CancellationChecker` measures `max_execution_time` from the registration of the query in the process list, which is earlier than the `start` of the polling loop in `InterpreterSystemQuery::syncMerges`. When the checker fires first, the loop saw only `isQueryCanceled` and threw `QUERY_WAS_CANCELLED`, although the cancel reason is the timeout. Check `QueryStatus::throwIfKilled` instead, which throws `TIMEOUT_EXCEEDED` for a timeout cancellation. This made `05317_sync_merges_waits_for_commit` fail in the flaky check of ClickHouse#71028: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=71028&sha=8756552a877bdecfeaed1cce864ace0a31b8288a&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20flaky%20check%29 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ad-setting # Conflicts: # tests/queries/0_stateless/01169_alter_partition_isolation_stress.sh
…count planner side effects A positive value makes the planner build one more plan to estimate the rows to read. That plan runs the index analysis, the query condition cache, the join order optimizer and subquery caching once more, which changes exact counters and log lines in: `03229_query_condition_cache_profile_events`, `03622_explain_indexes_distributed_index_analysis_in`, `05055_subquery_profile_query_cache`, `05293_dpsub_conflict_detector_flattens_all_join_kinds`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=71028&sha=9839373cf30abf823cbcecfdfac1f8e7773b47b7&name_0=PR Co-Authored-By: Claude Opus 5.5 <[email protected]>
…f_rows_per_replica` - `03518_key_condition_binary_search` counts index search profile events. The extra plan that estimates the rows to read runs the index analysis again, so pin the setting to `0`. - `02769_parallel_replicas_unavailable_shards` expects the unavailable replica to be picked. A positive value lowers the number of replicas for the 10-row table, so the counter stays `0`. - `05452_pr_min_rows_estimate_direct_join_merge_tree` flakily failed in the `distributed plan` job: a remote replica that receives a serialized query plan cannot build a direct join yet (#105260). The test is about the plan built on the initiator, so it now sets `serialize_query_plan = 0`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=71028&sha=6494bace60a09a4c9e5697f5a0d03ed06a4e36d9&name_0=PR PR: #71028 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… `05099` Both tests count query condition cache effects (`SelectedMarks` and cache hits). With `parallel_replicas_min_number_of_rows_per_replica 1` the planner builds an extra plan to estimate the rows to read, and that estimate consults the query condition cache too, so the counts change. Pin the setting to `0`, as in `03229`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=71028&sha=e2b86d280fadb12304521db43e6bbd0053ffd136&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20sequential%29 PR: #71028 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…plan With parallel_replicas_min_number_of_rows_per_replica > 0, collectFiltersForAnalysis plans a clone of the query in which only the join-tree tables are replaced by dummies, and it disabled parallel replicas only in the clone's top context. An IN subquery keeps its real table and shares its context with the original tree, so that throwaway planner planned the subquery with parallel replicas: a row estimate (one index analysis of the subquery's read), a coordinator and a local replica plan, none of which is ever executed since ClickHouse#121283 made the outer estimate decline on an unbuilt set. The real execution then analyzes the subquery read again. Copy the context of every QueryNode/UnionNode of the clone and disable parallel replicas there, the way the local replica plan, the remote plan and scalar subqueries already do. Copies are assigned to the clone's nodes only, so the original query tree keeps its settings. Related: ClickHouse#71028 Related: ClickHouse#118275 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o-read-setting Conflict in `collectFiltersForAnalysis`: master now disables parallel replicas in every (sub)query context via `traverseQueryTree` (also skipping materialized CTEs), which supersedes the PR's own equivalent loop, so master's version is taken.
|
🕵 Merged
All public CI jobs passed. |
|
🕵 Merged
I asked for these to be investigated on the sync PR. |
…o-read-setting `collectFiltersForAnalysis` moved from `Planner.cpp` to `PlannerSteps.cpp` on master; the PR's `keep_logical_steps = true` change is ported there.
Changelog category (leave one):
Details
The setting enables code execution, which can trigger hidden bugs, in particular in GLOBAL JOINs with parallel replicas. Discovered one while doing #70658 within
02967_parallel_replicas_joins_and_analyzertestWorkflow [PR]
Sync PR [sync-upstream/pr/71028]