Skip to content

Do not run 00673_subquery_prepared_set_performance with parallel replicas - #130153

Merged
alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:keep-00673-off-parallel-replicas
Nov 8, 2026
Merged

alexey-milovidov merged 2 commits into
ClickHouse:masterfrom
groeneai:keep-00673-off-parallel-replicas

Conversation

@groeneai

@groeneai groeneai commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #124015

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

...

Description

00673_subquery_prepared_set_performance fails in Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel): its system.query_log check max(read_rows) < 2000000 AND count() >= 2 returns 0.

The ParallelReplicas job enables parallel replicas in the server profile. Each replica that executes a measured query builds its own copy of the 1M-key IN set, and when a remote replica reads the table's only granule its rows are added to the initiator's progress: the failing job's query_log shows read_rows = 2000001 (1000000 local + 1000001 remote). That is how parallel replicas count rows, not a second preparation of the set.

The test is now tagged no-parallel-replicas, like 02233_set_enable_with_statement_cte_perf for the same reason: the ParallelReplicas job skips it, and every other job runs it with the runner's --enable_parallel_replicas 0, which replaces the enable_parallel_replicas=(0, 0) random-settings clamp. The measured queries and the .reference are unchanged.

Validation on a server configured like the job: the runner with --no-parallel-replicas skips the test; without it, 50/50 randomized runs pass, with parallel reading off for all 100 measured queries and no secondary queries. With the failpoint parallel_replicas_wait_for_unused_replicas (unused replicas are not cancelled), the tagged file prints 1 20/20 with the runner's override and 0 10/10 without it (initiator read_rows 3000001).

#126681 fixed an earlier, different failure of this test (a spilled IN set).

🤖 Generated with Claude Code


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

Version info

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

…_prepared_set_performance

The ParallelReplicas job turns parallel replicas on in the server profile, which the
`enable_parallel_replicas=(0, 0)` random-settings clamp cannot reach. Every replica that
executes a measured query builds its own copy of the `IN` set, and a remote replica that
reads the only granule reports its rows to the initiator, so the initiator's `read_rows`
becomes 2000001 and the `max(read_rows) < 2000000` check fails. Pin
`enable_parallel_replicas = 0` on the two measured queries only. The comment sits next to
the check: a comment directly above a query becomes part of its logged text, and the check
matches the queries with `query LIKE 'SELECT * FROM (SELECT%'`.

Failing job: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=127016&sha=6f98a2c7d072a5aa5d2ff2a2271667981e9e2dd4&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

groeneai commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 1 finding;
bounded: 1 full pass + 1 fix round + 1 delta recheck).

# Sev Finding Verdict Evidence / action
1 ⚠️ The final query_log check does not itself prove the two measured queries stayed off parallel replicas; suggests adding ProfileEvents['ParallelReplicasQueryCount'] = 0 DISAGREE Both measured queries carry the pin. The check guards one preparation of the IN set, and it fails deterministically once the unpinned state shows up (pin removed from query 2 + failpoint: 10/10 0, read_rows 3000001). Same pin-only shape as the merged #124500; the extra assertion would be vacuous outside the ParallelReplicas job.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding. Findings on hunks unchanged by the fix round are auto-dropped.

Session id: cron:clickhouse-review-slot-9:20261108-130600

@groeneai

groeneai commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. On a server configured like the ParallelReplicas job, with the failpoint parallel_replicas_wait_for_unused_replicas before each measured query and the failing run's draws, the old test prints 0 on line 3 20/20.
b Root cause explained? The job enables parallel replicas in the server profile, which the line-1 clamp does not reach. Each replica builds its own IN set, and a remote replica that reads the only granule adds its rows to the initiator's read_rows (2000001 in the failing job).
c Fix matches root cause? Yes. The two measured queries run with enable_parallel_replicas = 0, which overrides the profile; no bound is widened and no tag is added.
d Test intent preserved / new tests added? Yes. The assertion and .reference are unchanged; a per-level re-preparation of the set still reads a multiple of 1000000 rows. Test-only fix.
e Both directions demonstrated? Yes. Old test 20/20 0 (initiator read_rows 3000001), new test 20/20 1 (1000001, no secondary queries), at parallel_replicas_local_plan 1 and 0; removing the pin from one query gives 0 10/10. 50/50 randomized runs on that server and 50/50 on a plain one.
f Fix is general across code paths? Both measured queries are pinned; the check query and the DDL carry no checked value. No other read_rows + IN (SELECT ...) test fails this way in the ParallelReplicas job in 30 days.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only setting pin).
h Backward compatible? (maintainer-approved exception only) N/A (test-only, no setting or default change).
i Invariants and contracts preserved? Yes. The line-1 Random settings limits clamp is unchanged and still applies (checked in system.query_log); the new comment is placed so that the check's LIKE still matches both queries.

Session id: cron:clickhouse-impl-slot-7:20261108-124800

@clickhouse-gh

clickhouse-gh Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [cba292a]

Summary: ✅


AI Review

Summary

Reviewed head cba292a4e7312542817d7eb378fe15dfe0041fc4. This test-only change replaces the parallel-replica random-setting clamp with no-parallel-replicas, preserving the existing assertions while avoiding replica-dependent read_rows. It follows the maintainer's requested approach. No actionable findings. The current-head Fast test passes 00673_subquery_prepared_set_performance; the full CI run is still pending.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Nov 8, 2026
@groeneai

groeneai commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author

cc @devcrafter, could you review this and add the can be tested label so CI runs? In the ParallelReplicas job the server profile turns parallel replicas on, so when a remote replica reads the only granule its rows are added to the initiator's read_rows (2000001) and the check for a single preparation of the IN set fails; the two measured queries now pin enable_parallel_replicas = 0.

@clickhouse-gh clickhouse-gh Bot added can be tested Allows running workflows for external contributors comp-testing Test content only (no production code). labels Nov 8, 2026
@devcrafter devcrafter self-assigned this Nov 8, 2026
@devcrafter

Copy link
Copy Markdown
Member

@groeneai the test should either disabled with tag or fixed with enabled parallel replicas. Having settings clamping for parallel replcias and disabled parallel replicas per query - look more then strange - whatever reason it is

Per review on ClickHouse#130153: replace the per-query `enable_parallel_replicas = 0`
pins and the `enable_parallel_replicas=(0, 0)` random-settings clamp with the
`no-parallel-replicas` tag.

Under parallel replicas each replica builds its own 1M-row `IN` set, and a
remote replica that reads adds its rows to the initiator's `read_rows`, so the
"set prepared once" check sees 2000001 or 3000001. The tag skips the test in
the ParallelReplicas job and makes the runner append
`--enable_parallel_replicas 0` last in every other job, which also covers the
`automatic_parallel_replicas_mode = 2` draw that the old clamp was for. The two
measured queries are back to their master text.

Validated on a server with the ParallelReplicas job's profile: the runner with
`--no-parallel-replicas` skips the test; without it, 50/50 randomized runs pass
with parallel reading off on all 100 measured queries and no secondary queries.
With the `parallel_replicas_wait_for_unused_replicas` failpoint, the new file
passes 20/20 with the tag's client override and fails 10/10 without it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai changed the title Keep parallel replicas off for the measured queries of 00673_subquery_prepared_set_performance Do not run 00673_subquery_prepared_set_performance with parallel replicas Nov 8, 2026
@groeneai

groeneai commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks, done in cba292a: the test is now tagged no-parallel-replicas, and both the per-query pins and the enable_parallel_replicas=(0, 0) clamp are gone (outside the ParallelReplicas job the tag already makes the runner pass --enable_parallel_replicas 0). I picked the tag over keeping parallel replicas on: with them the initiator's read_rows depends on how many replicas got to read, so the check could only be loosened, not kept.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 8, 2026
@alexey-milovidov alexey-milovidov self-assigned this Nov 8, 2026
Merged via the queue into ClickHouse:master with commit 288e5fa Nov 8, 2026
187 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 8, 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

can be tested Allows running workflows for external contributors comp-parallel-replicas Parallel reading from replicas for query speed (not data replication consistency). pr-ci 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.

4 participants