Skip to content

Tag 05080_dedup_hash_lazy_replicated_column as no-parallel-replicas - #123943

Merged
fm4v merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-05080-dedup-hash-parallel-replicas
Oct 9, 2026
Merged

fm4v merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-05080-dedup-hash-parallel-replicas

Conversation

@groeneai

@groeneai groeneai commented Oct 5, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #114577
Related: #123790

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

05080_dedup_hash_lazy_replicated_column returns 2000 instead of 1000 in Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel) (report, 18 of 27 reruns with the same settings failed).

The test expects the second INSERT ... SELECT to be deduplicated against the first. The dedup hash is per source chunk, so both inserts must produce the same chunks in the same order, which the test gets from max_threads = 1 on one server. That run drew index_granularity = 1, so the 10-row probe table has 10 marks, and on s3 storage the parallel replicas read requests are only a few marks (the remote filesystem thresholds are 0). A remote replica that announces in time reads some of the marks, which depends on timing, so the two inserts get different chunks and nothing is deduplicated. Only release builds draw index_granularity below 100, so the amd_llvm_coverage ParallelReplicas lane does not hit this; the arm_binary lane comes back with #123790.

The test is now tagged no-parallel-replicas: it is skipped in the ParallelReplicas jobs, and elsewhere the runner passes enable_parallel_replicas = 0. The bug under test (the lazily replicated column hashed differently from the dense one) does not depend on parallel replicas.

Validation on a local three-replica cluster (index_granularity = 1, the s3 read thresholds set to 0, the ParallelReplicas profile): the test without the tag fails 11/50 runner runs with the CI diff (-1000 / +2000). With the tag it is skipped under the job's --no-parallel-replicas; without that flag none of 43 completed runs returns 2000 (the other 7 hit an unrelated local session_timezone draw), and system.query_log shows 0 of 86 inserts on parallel replicas.


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

Version info

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

…lel replicas

The test checks that the second INSERT ... SELECT is deduplicated against the
first one: the same rows in the same order, only the column representation
differs. The insert deduplication hash is computed per source chunk, so it
depends on chunk boundaries and order, which the test makes deterministic with
`max_threads = 1` on one server.

In the ParallelReplicas job the SELECT reads the probe table with parallel
replicas. With a randomized `index_granularity` below 10 the 10-row probe has
several marks, and on `s3 storage` the read requests are small enough that the
coordinator can give some marks to a remote replica. Which replica reads which
marks depends on announcement timing, so the two inserts produce different
chunks, nothing is deduplicated and `count()` is 2000 instead of 1000.

Pin `enable_parallel_replicas = 0` on both inserts. The defect under test (the
lazily replicated column hashed differently from the dense one) does not depend
on how reads are spread over replicas.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-request PR origin: a maintainer pinged or directed groeneai labels Oct 5, 2026
@groeneai

groeneai commented Oct 5, 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) plus my own cold review (1 nit).

# Sev Finding Verdict Evidence / action
1 💡 The new test comment says the replicas' rows arrive "in a different order each time"; the split depends on replica announcement timing (2000 in 33/100 local iterations), so not every time AGREE noted, not blocking (comment wording only)

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

Session id: cron:clickhouse-review-slot-11:20261005-042000

@groeneai

groeneai commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? On a local three-replica cluster with index_granularity = 1 on both source tables and the s3 read thresholds (merge_tree_min_{rows,bytes}_for_concurrent_read = 0): the unfixed test returns 2000 in 33/100 iterations and fails 11/50 runner runs. Each control without one ingredient (granularity 8192, no parallel replicas, local-disk thresholds) gives 0 flips.
b Root cause explained? The dedup hash is per source chunk. With several marks and small read requests, a remote replica that announces in time reads some marks of the probe, so the two inserts produce different chunks and the second is not deduplicated.
c Fix matches root cause? Yes: both inserts pin enable_parallel_replicas = 0, restoring the single-stream read the oracle needs. No tag, no granularity clamp, no ORDER BY (sorting would rebuild the lazily replicated column).
d Test intent preserved / new tests added? Yes: both inserts still run the hash join with lazy replication on and off on one server, as in every other lane. .reference unchanged.
e Both directions demonstrated? Loop: unfixed 33/100 2000, fixed 100/100 1000. Runner with the CI profile: unfixed 11/50 FAIL with the CI diff, fixed 50/50 OK. Regular randomized: fixed 50/50 OK.
f Fix is general across code paths? Both inserts are pinned; the other statements read numbers() or are a trivial count. Covers AutoParallelReplicas too (it requires enable_parallel_replicas != 0).
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only change).
h Backward compatible? (maintainer-approved exception only) N/A (no setting, format or engine change).
i Invariants and contracts preserved? N/A for engine code; the test's invariant (identical chunks in identical order for both inserts) now holds in every CI configuration.

Session id: cron:clickhouse-impl-slot-7:20261005-035000

@clickhouse-gh

clickhouse-gh Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [94fe47b]

Summary: ✅


AI Review

Summary

This PR replaces the per-query enable_parallel_replicas = 0 pins in tests/queries/0_stateless/05080_dedup_hash_lazy_replicated_column.sql with the no-parallel-replicas tag and a short rationale. That matches the requested follow-up on the PR, and the runner logic in tests/clickhouse-test does what the change relies on: it skips tagged tests in ParallelReplicas lanes and forces enable_parallel_replicas = 0 elsewhere unless the test explicitly overrides it. I did not find any unresolved correctness, metadata, or coverage issues in the current diff.

Final Verdict
  • Status: ✅ Approve

@groeneai
groeneai requested a review from devcrafter October 5, 2026 04:40
@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 5, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 5, 2026
@devcrafter devcrafter self-assigned this Oct 5, 2026

@devcrafter devcrafter left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@groeneai let's use Tag no-parallel-replicas for the test instead, and add concise comment why

…ead of pinning the inserts

Review request: replace the two per-insert `enable_parallel_replicas = 0` pins
with the `no-parallel-replicas` tag. The tag skips the test in the
ParallelReplicas job and makes the runner pass `enable_parallel_replicas = 0`
everywhere else, so both inserts read on one server and produce the same
chunks in the same order, which the deduplication check needs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai changed the title Keep the inserts of 05080_dedup_hash_lazy_replicated_column off parallel replicas Tag 05080_dedup_hash_lazy_replicated_column as no-parallel-replicas Oct 5, 2026
@groeneai

groeneai commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks, done in 94fe47b: the test is tagged no-parallel-replicas with a short reason in its header, and the two per-insert pins are removed.

@fm4v
fm4v added this pull request to the merge queue Oct 8, 2026
Merged via the queue into ClickHouse:master with commit 8942774 Oct 9, 2026
149 checks passed
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 9, 2026
JingYanchao pushed a commit to JingYanchao/ClickHouse that referenced this pull request Nov 16, 2026
The test asserts that a repeated INSERT ... SELECT with the same
insert_deduplication_token is deduplicated. The dedup block id depends on
how the source read is chunked, so both inserts must produce the same
chunks; the test pins the query-level read shape but not parallel
replicas, which the ParallelReplicas jobs enable server-side.

With a small randomized index_granularity (15 on ClickHouse#94017) the 20000-row
source has 1333 marks. On s3-backed parts the replicas read it in 13 or 14
requests depending on timing, and when the two inserts make a different
number of requests the chunks differ and the repeat is appended (40000
instead of 20000). Measured locally: 21 of 21 failing pairs had different
request counts, 16 of 16 deduplicated pairs had equal ones; a different
mark split alone does not break deduplication (local disk: 173 requests
per insert, 0 of 400 runs failing). In the automatic parallel replicas
runs of ClickHouse#120438 the first insert runs single-node and the second on
parallel replicas, so those draws fail every rerun.

CI: ClickHouse#94017 arm_binary ParallelReplicas s3 (22/53 reruns), ClickHouse#120438
amd_debug and arm_binary ParallelReplicas s3 (94/94, 50/50), ClickHouse#124526
arm_binary ParallelReplicas s3 (38/38). No master failure.

Same fix as 05080_dedup_hash_lazy_replicated_column in ClickHouse#123943: skipped
in the ParallelReplicas jobs, enable_parallel_replicas = 0 elsewhere.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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-testing Test content only (no production code). groeneai-origin-request PR origin: a maintainer pinged or directed groeneai 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