Skip to content

Make 03354_pr_disable_for_multiple_tables_query work with plan-based parallel replicas - #128142

Merged
devcrafter merged 3 commits into
masterfrom
pr-multiple-tables-probe-both-implementations
Nov 1, 2026
Merged

devcrafter merged 3 commits into
masterfrom
pr-multiple-tables-probe-both-implementations

Conversation

@devcrafter

@devcrafter devcrafter commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

03354_pr_disable_for_multiple_tables_query checks that parallel_replicas_for_queries_with_multiple_tables reaches every place that plans a part of a multi-table query, by looking for ReadFromRemoteParallelReplicas in EXPLAIN. With parallel_replicas_plan_based the read from the other replicas is ReadFromParallelReplicas, so every probe printed 0 and the test failed with plan-based parallel replicas on by default (#112351).

  • Each probe matches either step and prints whether there is one, not how many: the two implementations split the same query into a different number of reads (2 against 1 for the joins with an ORDER BY subquery).
  • The UNION probes read distinct tables (Z and W, copies of X): plan-based parallel replicas leave local a union whose branches read the same table, so X union all X showed no read from the other replicas even with the setting on, and the probe could not tell whether the setting was obeyed.

With the setting off, every probe prints 0 under both implementations. The test passes locally with parallel_replicas_plan_based on and off.

Related: #112351

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.999-master (included in 26.11 and later)

@clickhouse-gh

clickhouse-gh Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e8ae2b3]

Summary: ✅


AI Review

Summary

This test-only PR makes 03354_pr_disable_for_multiple_tables_query support both parallel-replica implementations by matching either read step, checking presence, and using distinct tables in the UNION probes. No actionable findings. The changed test passes in current-head Fast test; the existing review also provides validation of both implementations and verifies that breaking setting propagation makes the test fail.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Oct 29, 2026
@devcrafter
devcrafter requested a review from groeneai October 29, 2026 12:48
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 29, 2026

@groeneai groeneai left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed 6ce66f3 with the master debug binary at its merge base (474f3e32, the PR changes only the test), on a local server with test_cluster_one_shard_three_replicas_localhost pointed at it.

  • The test passes at parallel_replicas_plan_based = 0 and = 1: 9 of 10 randomized runs OK at each value, the other run failed before the first query on a session_timezone draw my local box rejects (Code: 36).
  • With the setting on, query-based has 1 to 3 ReadFromRemoteParallelReplicas per probe (2 for the ORDER BY subquery joins and the X/Z union, 3 for the nested union), and plan-based has exactly one ReadFromParallelReplicas in every probe. With the setting off, both have none. So presence is the one check that fits a single reference for both.
  • The probes can still fail. With disableParallelReplicasForSubqueries made a no-op, the test goes red under both implementations: 7 off arms flip to 1 with query-based, 6 with plan-based. The one that stays 0 with plan-based is X as s inner join (select * from Y) as j, as expected: plan-based checks the context of the coordinated read, and Y is the broadcast side.

Outside this PR: the plan-based fragment takes its context from the last coordinated read (applyParallelReplicas.cpp#L684-L692), so enable_parallel_replicas = 0 on an earlier union branch is not honored. select * from ((select id from X settings enable_parallel_replicas = 0) union all (select id from Z)) ships both reads in one ReadFromParallelReplicas, while query-based reads X locally. The switch tested here is not affected, since it disables every branch.

@devcrafter
devcrafter enabled auto-merge October 31, 2026 23:01
@devcrafter
devcrafter added this pull request to the merge queue Nov 1, 2026
Merged via the queue into master with commit c189bd9 Nov 1, 2026
180 checks passed
@devcrafter
devcrafter deleted the pr-multiple-tables-probe-both-implementations branch November 1, 2026 00:51
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 1, 2026
alexey-milovidov pushed a commit to Onyx2406/ClickHouse that referenced this pull request Nov 1, 2026
The merge queue fast-forwards master over up to 5 merges in one push and
MasterCI runs once, for the push head. For a push, praktika read the changed
files of the head commit only (`gh api commits/{sha}`), so a job affected
only by an earlier commit of the same push was filtered as "Not affected by
the changed files and not required", and functional/integration shards
skipped themselves as "Only test files changed". At master c189bd9 (ClickHouse#128277
in `src/` + ClickHouse#128142 tests only) this skipped 95 jobs, including both
`Build (*_release_performance_reference)`, so PR performance runs based on it
fell back to the official build (`long_primary_key` +16% on amd, ClickHouse#127846).
At f760cbb all 32 builds were skipped.

Now a push event records its `before` (`_Environment.PUSH_BEFORE_SHA`), and
`GH.get_changed_file_statuses` walks first parents from the head down to it,
reading all pages of each commit's file list (`gh api --paginate`), and
unions them (the newest commit's status wins). If the files cannot all be
known - an all-zero or malformed `before` (created branch), a failed or
malformed read, a commit at GitHub's 3000-file listing limit, a walk that
does not reach `before` within 50 commits - the result is `None` with a
warning, never a partial list, and it is not cached. `store_data.py` keeps
`None` for push events, so no job is filtered by it (`Job.is_affected_by`);
before, a failed read stored `[]`, which filtered every non-required job.
Without `before` (local runs, the native orchestrator) the head-only read
is unchanged; PR, merge queue, schedule and dispatch are unchanged.

Validated locally against the real GitHub API by replaying the 404 batched
master pushes of October: the result equals the union of every pushed
commit's files (re-parsed independently, commit lists from git) on 402, and
is unknown on the 2 that contain a 3000-file commit (ClickHouse#126194, and the docs
translation ClickHouse#124860); the job filter keeps 14,871 more job-runs on 131
pushes, plus 952 test shards that self-skipped now run in full, ~+7.8% of
October's 203,420 master job-runs, including both reference builds on 106
pushes. 100 single-commit pushes give identical statuses, with one request
for heads of up to 100 files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants