Skip to content

Keep the IN-subquery queries of 00945_bloom_filter_index off parallel replicas - #123761

Merged
devcrafter merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-00945-in-subquery-off-parallel-replicas
Oct 5, 2026
Merged

devcrafter merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-00945-in-subquery-off-parallel-replicas

Conversation

@groeneai

@groeneai groeneai commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #122853
Related: #104924

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

00945_bloom_filter_index fails in Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel) with Limit for rows or bytes to read exceeded, max rows: 7.00, current rows: 8.00: While executing Remote. (TOO_MANY_ROWS) on one of the four IN (SELECT arrayJoin(...)) SETTINGS max_rows_to_read = 7 queries: 3 unrelated PRs on 2026-10-03, the day #122853 added this job. No related open issue found.

The budget 7 is one granule (6 rows) plus the one row of system.one the subquery reads. With parallel replicas the subquery also runs on the replica that reads the granule (parallel_replicas_allow_in_with_subquery), and the limit counts the rows of all replicas. When the remote replica that owns the only mark asks the coordinator before the local replica takes it, the count is 1 + 1 + 6 = 8. Both set builds really read that row, so the count is correct; the exact budget only holds on one node.

Change. enable_parallel_replicas = 0 on these four queries only. The other 44 budgeted queries have no subquery, each mark is read by one replica, and they keep running on parallel replicas.

Validation (master debug build, 3-replica loopback cluster, failpoint slowdown_parallel_replicas_local_plan_read, max_threads >= 2):

  • before: 20/20 fail with current rows: 8.00; the coordinator gives the mark to replica 1, as in the CI server log;
  • after: 20/20 pass; the four queries use no remote replicas, WHERE i32 = 1 still does;
  • negative control (pin removed from the first query): 20/20 fail again;
  • 50 randomized runs: 50/50 OK on a regular server, 50/50 OK with the job's parallel-replicas profile, where the unfixed test fails 36/50.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.10.1.1556-master (included in 26.10 and later)

… replicas

`max_rows_to_read = 7` on the four `IN (SELECT arrayJoin(...))` queries is one
granule (6 rows, `index_granularity = 6`) plus the one row of `system.one` the
subquery reads. Under parallel replicas the subquery also runs on every follower
(`parallel_replicas_allow_in_with_subquery`), and the limit is checked against
the total of all sources, remote ones included. When the remote replica that
owns the only mark by hash asks the coordinator before the local replica steals
it, it builds its own set and reads the granule: 1 + 1 + 6 = 8 > 7, so the query
fails with TOO_MANY_ROWS "While executing Remote". Seen 3 times on 2026-10-03 in
`Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel)`.

Pin `enable_parallel_replicas = 0` on these four queries only, so the exact
single-node budget stays; the rest of the test keeps running on parallel
replicas, where each mark is read by exactly one replica.

Local repro: 3-replica loopback cluster, failpoint
`slowdown_parallel_replicas_local_plan_read`, `max_threads >= 2`: unfixed file
fails 20/20 with `current rows: 8.00`, fixed file passes 20/20.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Oct 3, 2026
@groeneai

groeneai commented Oct 3, 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; 0 findings on the test-only diff) plus my own cold review (2 nits).

# Sev Finding Verdict Evidence / action
1 💡 PR description counted 45 other budgeted queries; the file has 48, 4 pinned, so 44 AGREE, fixed in the description no code change
2 💡 The test comment says the subquery runs again "on the replica that reads the granule", while parallel_replicas_allow_in_with_subquery runs it on every follower DISAGREE only the follower that reads the granule reports its row before the others are cancelled, so the comment describes what is counted

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

Session id: cron:clickhouse-review-slot-9:20261003-205800

@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. 3-replica loopback cluster, failpoint slowdown_parallel_replicas_local_plan_read, max_threads >= 2: the unfixed test fails 20/20 with max rows: 7.00, current rows: 8.00: While executing Remote.
b Root cause explained? The budget 7 is one granule plus the subquery's system.one row. Under parallel replicas the subquery also runs on the replica that reads the granule, and the limit counts all replicas: 1 + 1 + 6 = 8 when the remote hash owner of the only mark asks first.
c Fix matches root cause? Yes. The exact budget is a single-node count, so only the four queries whose count depends on the replica count run without parallel replicas. No widened bound, no blanket tag.
d Test intent preserved / new tests added? Yes. The four queries still assert one granule plus the subquery row with the bloom filter; the other 44 budgeted queries still run on parallel replicas (verified in query_log). Test-only fix.
e Both directions demonstrated? Yes. Unfixed 20/20 fail, fixed 20/20 pass, pin removed from one query 20/20 fail; runner with the job's profile: unfixed 36/50 fail, fixed 50/50 pass.
f Fix is general across code paths? These are the only budgeted queries with a subquery. Running the IN subquery on followers is documented behaviour.
g Fix generalizes across inputs (params/datatypes/wrappers)? All four key shapes (scalar, tuple, mixed tuple, nested tuple) are pinned; CI failed on two of them.
h Backward compatible? (maintainer-approved exception only) N/A, test-only.
i Invariants and contracts preserved? .reference unchanged; the setting is a no-op in jobs without parallel replicas.

Session id: cron:clickhouse-impl-slot-7:20261003-193100

@groeneai
groeneai requested a review from devcrafter October 3, 2026 21:22
@clickhouse-gh

clickhouse-gh Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [593be56]

Summary: ✅


AI Review

Summary

This PR makes 00945_bloom_filter_index deterministic in the parallel-replicas CI profile by turning enable_parallel_replicas off only for the four IN (SELECT arrayJoin(...)) probes whose max_rows_to_read = 7 budget becomes replica-count-dependent once parallel_replicas_allow_in_with_subquery re-executes the subquery on follower replicas. I do not see a correctness issue in the change: it removes the flaky shape without widening the row budget or disabling parallel replicas for the rest of the file, so the broader skip-index coverage under parallel replicas stays intact.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Oct 3, 2026
@groeneai

groeneai commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - ea97c81

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Build (amd_fuzzers) / Build ClickHouse not from this PR: the clickhouse_fuzzer link fails with relocation R_X86_64_PC32 out of range against the 2 GiB reach of the small code model; the same job is red on master and on 156 PRs in the last 24h #123738 (external, open)
Mergeable Check, PR rollups, red only because of the row above #123738 (external, open)

The diff is one test file. All checks completed; CIDB has no other FAIL or ERROR on this head.

Session id: cron:our-pr-ci-monitor:20261004-000624

@devcrafter devcrafter self-assigned this Oct 4, 2026
@devcrafter
devcrafter enabled auto-merge October 4, 2026 23:38
@devcrafter
devcrafter added this pull request to the merge queue Oct 5, 2026
Merged via the queue into ClickHouse:master with commit e9b645e Oct 5, 2026
149 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 5, 2026
@clickhouse-gh clickhouse-gh Bot added comp-skip-index Skipping indexes (minmax, set, bloom) and their evaluation. 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-skip-index Skipping indexes (minmax, set, bloom) and their evaluation. groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding 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.

3 participants