Skip to content

Pin the tests that measure what plan-based parallel replicas does not do yet - #118277

Closed
devcrafter wants to merge 6 commits into
masterfrom
pin-plan-based-pr-feature-gaps
Closed

devcrafter wants to merge 6 commits into
masterfrom
pin-plan-based-pr-feature-gaps

Conversation

@devcrafter

@devcrafter devcrafter commented Sep 5, 2026 •

Copy link
Copy Markdown
Member

Five tests fail with parallel_replicas_plan_based = 1 and pass with it off, so each is pinned to
the implementation it describes.

The plan-based step carries the shipped fragment in its description, whose lines then match
filters that look for ReadFromMergeTree, and its pipeline is shaped differently:
03560_parallel_replicas_memory_bound_merging_projection, 04277_parallel_replicas_join_dp_reorder,
04371_implicit_bool_filter_projection_parallel_replicas. Where these files also check results,
those checks are left on the default implementation.

No automatic parallel replicas statistics are collected, so the candidacy assertions read 0:
03634_autopr_input_bytes_estimation_compact, 05043_autopr_set_source_leaf_steps. In both cases
the query is not parallelized at all under plan-based, so there is nothing to instrument:
05043 filters with an IN set over numbers, which plan-based cannot ship, and 03634's
query_8 is an ORDER BY ... LIMIT whose read is kept local on purpose, because the internal
__topKFilter function it puts into PREWHERE is not registered and a replica could not deserialize
the fragment.

Pins that are no longer needed are dropped - 03394_pr_insert_select,
03394_pr_insert_select_local_pipeline, 03394_pr_insert_select_threads,
04052_distributed_index_analysis_in_subquery_no_quadratic, 04341_autopr_mode1_apply_join - each
measured over 10 unpinned runs with the setting on. Ten rather than three because 03634 passed 3 of
3 and then failed on the fourth, and 05175_autopr_lazy_read_statistics fails about one run in ten.

03403_parallel_blocks_marshalling_for_distributed and
04647_no_blocks_marshalling_for_local_shard_plan moved to
#126793, 03215_analyzer_replace_with_dummy_tables
moved to #127038, and master has since removed the case
03707_autopr_unsupported_cases was pinned for.

All pinned tests, and all unpinned ones, pass with parallel_replicas_plan_based defaulting to 1 and
to 0.

Related: #112351

Changelog category (leave one):

  • CI Fix or Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

...

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/118277]

… do yet

Sixteen files, each pinning `parallel_replicas_plan_based = 0` on the assertion that cannot hold for
the plan-based implementation, with a comment and a tracking issue. This is what stands between CI
and running with the setting turned on; the gaps themselves are left for later.

- `BlocksMarshalling` steps are not inserted, so blocks from the replicas are not marshalled in
  parallel: `04647_no_blocks_marshalling_for_local_shard_plan`,
  `03403_parallel_blocks_marshalling_for_distributed`.
  #118274
- `parallel_distributed_insert_select = 2` stops distributing the insert: `03394_pr_insert_select`,
  `03394_pr_insert_select_local_pipeline`, `03394_pr_insert_select_threads` (the last one is tagged
  `long`, so the Fast test never reported it).
  #118276
- A plan that builds an `IN` set is not distributed at all, so nothing resolves the cluster and
  nothing is instrumented: `05043_autopr_set_source_leaf_steps`,
  `03215_analyzer_replace_with_dummy_tables`.
  #118264
- Some plan shapes do not hash-match, so automatic parallel replicas collects no statistics:
  `03634_autopr_input_bytes_estimation_compact`,
  `04838_autopr_input_bytes_estimation_compact_codec`, `04341_autopr_mode1_apply_join`. The reverse
  also happens - plan-based matches the aggregation-over-aggregation shape that the query-based one
  cannot - so that one case in `03707_autopr_unsupported_cases` is pinned too.
  #118265
- Distributed index analysis runs one of its queries twice:
  `04052_distributed_index_analysis_in_subquery_no_quadratic`.
  #118275
- The shipped fragment is embedded in the step description, so its lines match a filtered `EXPLAIN`
  as extra rows: `03560_parallel_replicas_memory_bound_merging_projection`,
  `04277_parallel_replicas_join_dp_reorder`,
  `04371_implicit_bool_filter_projection_parallel_replicas`. The last one also matches the reading
  step by its query-based name.

Verified against a server with `parallel_replicas_plan_based` defaulting to `1`: all sixteen pass.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4752b62]

Summary: ✅


AI Review

Summary

Pins five stateless tests to query-based parallel replicas where plan output or statistics collection differs. ⚠️ Request changes: the remaining session-wide pin in 03634 also removes plan-based coverage from seven queries unaffected by the reported limitation.

Findings

⚠️ Majors

  • 03634_autopr_input_bytes_estimation_compact.sql:24: The remaining reproduced failure concerns query_8, whose Top-K read stays local. The session-wide parallel_replicas_plan_based = 0 also disables plan-based compact-part estimation coverage for query_1–query_7, which have no Top-K restriction. The current findTopNodeOfReplicasPlan preserves the wrapper above plain reads, so the original blanket explanation no longer applies. Move the override into query_8's SETTINGS clause and update the comment.
Final Verdict

Status: ⚠️ Request changes. Scope the 03634 pin to query_8, retaining the default implementation for the other seven estimation queries.

@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Sep 5, 2026
devcrafter added a commit that referenced this pull request Sep 7, 2026
The 16 test files are the pins from #118277, which is
still open: each pins `parallel_replicas_plan_based = 0` on an assertion that cannot hold for the
plan-based implementation, with a comment and a tracking issue. They are duplicated here so Fast
test on this branch stops reporting them and the other CI jobs become readable; the next `master`
merge after #118277 lands should resolve to identical content.

`parallel_replicas_allow_merge_tables` also moves from the `EXPERIMENTAL` to the `BETA` tier, because
this branch enables it by default and
`03413_experimental_settings_cannot_be_enabled_by_default` selects every `Experimental`-tier `Bool`
with a non-zero default. Branch-only, like the `parallel_replicas_plan_based` tier change in
`75f88198ff7`.

`04652_skip_indexes_in_read_pools` is deliberately left alone. It has never failed on `master` in 90
days, so it is a real trigger rather than a flaky test, but the mechanism is not established yet -
the local signal is drowned by this machine's own timing noise.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
devcrafter and others added 2 commits October 2, 2026 20:50
`04838_autopr_input_bytes_estimation_compact_codec` passes with
`parallel_replicas_plan_based` on: 18 runs with the pin removed, 12 against the
previous binary and 6 against a build of current master, with no failure, and
the same under the query-based default. The statistics gap it was pinned for
(#118265) no longer reaches this
test, so the pin only hid coverage.

The other fifteen pins stay. Measured the same way, with the pin stripped and
`parallel_replicas_plan_based = 1`, all of them still fail - and all of them
pass with the setting off, so the measurement is of the implementation rather
than of the stripping:

- fails on every run: `03215_analyzer_replace_with_dummy_tables`,
  `03403_parallel_blocks_marshalling_for_distributed`,
  `03560_parallel_replicas_memory_bound_merging_projection`,
  `03707_autopr_unsupported_cases`,
  `04052_distributed_index_analysis_in_subquery_no_quadratic`,
  `04277_parallel_replicas_join_dp_reorder`, `04341_autopr_mode1_apply_join`,
  `04371_implicit_bool_filter_projection_parallel_replicas`,
  `04647_no_blocks_marshalling_for_local_shard_plan`,
  `05043_autopr_set_source_leaf_steps`.
- fails on some runs, which is worse than a clean failure and not a reason to
  unpin: `03394_pr_insert_select`, `03394_pr_insert_select_local_pipeline`,
  `03634_autopr_input_bytes_estimation_compact`.
- `03394_pr_insert_select_threads` did not fail, but the harness runs it once
  per invocation and its two siblings are flaky on the same gap, so it keeps
  its pin until that gap is closed.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…eature-gaps

# Conflicts:
#	tests/queries/0_stateless/03707_autopr_unsupported_cases.sql
Measured against master's copies with a current build, 10 runs each with
`parallel_replicas_plan_based = 1`: `03394_pr_insert_select`,
`03394_pr_insert_select_local_pipeline`, `03394_pr_insert_select_threads`,
`04052_distributed_index_analysis_in_subquery_no_quadratic` and
`04341_autopr_mode1_apply_join` pass, so their pins only hid coverage.
`03403` and `04647` move to
#126793, and master has removed
the case `03707` was pinned for.

`03634_autopr_input_bytes_estimation_compact` keeps its pin: unpinned it
reported a statistics row where none is expected, once in ten runs.
It moved to #127038, which skips
the analysis the test covers.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
-- Pinned to the query-based implementation: for a plain read the plan-based fragment is the reading
-- step itself, so automatic parallel replicas cannot estimate what the replicas would send and
-- collects no statistics. See https://github.com/ClickHouse/ClickHouse/issues/118265.
SET parallel_replicas_plan_based = 0;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Scope the implementation pin to query_8

The updated PR description identifies query_8 as the remaining failure: its ORDER BY ... LIMIT read is deliberately kept local by Top-K. This session-wide setting also forces query_1 through query_7 onto the query-based implementation, removing plan-based coverage of the plain-read and filtered COUNT compact-part input-byte estimates even though those statements have no Top-K restriction. The current findTopNodeOfReplicasPlan already preserves the wrapper above a plain read, so the comment's original explanation no longer justifies pinning those cases.

Please move parallel_replicas_plan_based = 0 into query_8's SETTINGS clause and update the comment, leaving the other seven estimation checks on the default implementation.

@devcrafter

Copy link
Copy Markdown
Member Author

🕵 Closing: nothing is left to pin on current master.

  • 03560_parallel_replicas_memory_bound_merging_projection, 04277_parallel_replicas_join_dp_reorder, 04371_implicit_bool_filter_projection_parallel_replicas: master made them independent of the parallel replicas implementation (51668b7, 2d7b28b, 4558a37).
  • 05043_autopr_set_source_leaf_steps: 93678b3 made bounded numbers reads serializable, so plan-based now ships the IN set and the query is instrumented again.
  • 03634_autopr_input_bytes_estimation_compact: all eight queries, including query_8, collect statistics under plan-based now, so the pin is not needed at all (this also answers the review thread about scoping it to query_8).

Measured with the master CI binary 26.11.1.403 (3f1c2fc): the unpinned 03634 and 05043 passed 10/10 runs with parallel_replicas_plan_based = 1 and 5/5 with it off.

@devcrafter devcrafter closed this Oct 21, 2026
@clickhouse-gh clickhouse-gh Bot added comp-parallel-replicas Parallel reading from replicas for query speed (not data replication consistency). and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-parallel-replicas Parallel reading from replicas for query speed (not data replication consistency). pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant