Skip to content

Keep the ProfileEvents-checked reads of the columns cache tests off parallel replicas - #124528

Merged
fm4v merged 2 commits into
ClickHouse:masterfrom
groeneai:columns-cache-tests-profile-events-off-parallel-replicas
Oct 9, 2026
Merged

fm4v merged 2 commits into
ClickHouse:masterfrom
groeneai:columns-cache-tests-profile-events-off-parallel-replicas

Conversation

@groeneai

@groeneai groeneai commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #123790
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

Nine columns cache tests assert ProfileEvents['ColumnsCacheHits'/'ColumnsCacheMisses'] from system.query_log and fail in the ParallelReplicas lane with a 0 0 row, e.g. 04064_columns_cache_metrics on #123790: report. In the coverage lane the failures are relabeled OK, so they are hidden there: in 30 days 05216 408, 04064 400, 05136 246, 05215 174, 05060 124, 05230 26, 04068 23, 04339 8, 04074 8 failures (~1470 runs each, incl. master). Once #123790 merges they become visible on every PR.

The lane enables parallel replicas for every query, so a remote replica on the same server may read all marks of a measured read. Its ProfileEvents land on its own query_log row (current_database = 'default'), not on the initiator's row, which the test reads and which then has no cache events. The failing job's query_log artifact confirms it: an initiator row has no cache events exactly when its ParallelReplicasReadMarks is 0.

The change runs the measured reads with enable_parallel_replicas = 0: per query in 04064, 04074, 05136 and 05060, whose other reads keep running under parallel replicas; for the whole test in the other eleven (a session SET, or the client option in the shell test 04072). No reference changes. Six of them (04070, 04072, 05029, 05055, 05155, 05210) have not failed in that lane yet but carry the same precondition. The other columns cache tests with this oracle (05043, 05154, 05213, 05214) are already tagged no-parallel-replicas.

Validation on a local ParallelReplicas rig, same binary: with parallel_replicas_local_plan = 0 the unmodified tests fail 63/63 and the fixed ones pass 145/145; without it the unmodified nine fail 169/180 and all fixed tests pass 363/363. The fixed tests also pass with parallel replicas off.


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

Version info

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

…arallel replicas

The ParallelReplicas lane enables parallel replicas for every query, so a
remote replica on the same server may read all marks of a measured read. Its
ColumnsCacheHits/ColumnsCacheMisses then land on its own query_log row
(current_database = 'default'), and the initiator row that the test checks
has no cache events, which shows up as a `0 0` row. In the failing job's
query_log artifact an initiator row has no cache events exactly when its
ParallelReplicasReadMarks is 0 (231 of 231 rows of 04064).

Run the measured reads with enable_parallel_replicas = 0: in the SETTINGS of
each measured read where those are a minority of the test's reads (04064,
04074, 05136, 05060), and as a session SET where nearly every read is
measured (05216, 05215, 05230, 04068, 04339). The other reads keep running
under parallel replicas. In 05060 the comment avoids the word `query_log`,
because the client sends leading comments as part of the query text and the
oracle filters on `query NOT LIKE '%query_log%'`.

Measured on a local ParallelReplicas rig with one binary: unmodified tests
fail 169/180 runs (no failpoint) and 45/45 with parallel_replicas_local_plan
= 0; the fixed tests pass 270/270 and 90/90, and 450/450 without parallel
replicas. Removing the pin from one read of 04064 fails exactly that line.

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 8, 2026
@groeneai

groeneai commented Oct 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).

# Sev Finding Verdict Evidence / action
1 💡 The new comments leave literal names (enable_parallel_replicas, ProfileEvents, query_log) without inline code formatting (.claude/CLAUDE.md:5) AGREE, noted-not-blocking Comment style only. The 05060 comment keeps avoiding the word query_log: the client sends it as part of the next query's text, and that test's oracle filters on query NOT LIKE '%query_log%'.

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

Session id: cron:clickhouse-review-slot-8:20261008-003400

@groeneai

groeneai commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes: ParallelReplicas rig with parallel_replicas_local_plan = 0, all 9 unmodified tests fail 5/5 (0 0 rows).
b Root cause explained? A remote replica reads the marks, its ProfileEvents land on its own query_log row (current_database = 'default'), the initiator row the test reads has none.
c Fix matches root cause? Yes: the measured reads run with enable_parallel_replicas = 0, so the checked row is the row that read. No tag, no blacklist, no widened assertion.
d Test intent preserved / new tests added? Yes: oracles and references unchanged; removing the pin from one read fails exactly that line. Unmeasured reads still use parallel replicas.
e Both directions demonstrated? Yes, same binary: unmodified 169/180 fail in the CI shape and 45/45 forced; fixed 270/270 and 90/90 pass.
f Fix is general across code paths? All 9 tests with observed failures are fixed. 5 sibling columns cache tests with 0 failures in ~1470 lane runs are left as is.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only; the pin is a no-op without parallel replicas, 50/50 each).
h Backward compatible? (maintainer-approved exception only) N/A (test-only).
i Invariants and contracts preserved? N/A (test-only); Tags lines and .reference files untouched.

Session id: cron:clickhouse-impl-slot-7:20261007-232100

@clickhouse-gh

clickhouse-gh Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ae022b8]

Summary: ✅


AI Review

Summary

This PR makes the columns-cache tests that read ProfileEvents or memory_usage from system.query_log deterministic in the ParallelReplicas lane by pinning those measured reads to enable_parallel_replicas = 0. The follow-up commit also covers the remaining sibling one-task query_log oracles from the earlier review thread. I did not find any remaining uncovered tests of the same shape or any regression in the current diff.

Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 8, 2026
@groeneai
groeneai requested a review from fm4v October 8, 2026 01:01
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 8, 2026
…off parallel replicas

04070, 04072, 05029, 05055, 05155 and 05210 assert `ColumnsCacheHits`/`ColumnsCacheMisses` from
the initiator's `system.query_log` row, the same oracle as the nine tests fixed in the previous
commit. They have not failed in the `ParallelReplicas` lane yet, but they carry the same
precondition: when a remote replica reads all marks of a measured read, the initiator row has
no cache events. With `parallel_replicas_local_plan = 0` on a local `ParallelReplicas` rig the
unmodified tests fail 18/18 with exactly that shape, and pass 55/55 with the pin. The pinned
runs have no secondary replica query for any measured read. In all six tests the measured reads
depend on the cache state left by the reads before them, so the pin covers the whole test: a
session `SET`, and for the shell test 04072 the client option, which keeps it apart from the
lines changed by ClickHouse#123949.

Also quote the setting and table names in the comments of the pins, as the in-tree style asks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@fm4v
fm4v added this pull request to the merge queue Oct 8, 2026
Merged via the queue into ClickHouse:master with commit 208f610 Oct 9, 2026
152 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 9, 2026
valerypetrov pushed a commit to valerypetrov/ClickHouse that referenced this pull request Oct 9, 2026
…arallel replicas

In the ParallelReplicas configuration the coordinator hands mark ranges to whichever
replica asks first, so a remote replica sometimes reads every mark of the measured query.
That replica counts StringValueFilterValuesChecked/Replaced/BytesSkipped on its own
query_log row (is_initial_query = 0, current_database = 'default'), which the tests'
current_database = currentDatabase() filter drops, so the checked row reads 0.
Seen in the failing jobs' own query_log: every initiator row with 0 had a secondary row
carrying the events (e.g. 0/0 on the initiator, 100000/99000 on the secondary).

Run exactly the measured reads with enable_parallel_replicas = 0, as ClickHouse#124528 did for
the columns cache tests. The other reads of these tests keep running under parallel
replicas in that configuration. 05325 asserts 0 and cannot fail this way, but a remote
read made it pass whatever the guard does, so it is pinned too.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
jh0x pushed a commit to jh0x/ClickHouse that referenced this pull request Oct 11, 2026
…lesystem_cache` off parallel replicas

In the `ParallelReplicas` CI configuration every query runs with parallel
replicas, and the coordinator hands the marks to whichever replica asks
first. When the remote replicas read all of them, the cache, file
descriptor and throttler `ProfileEvents` land on their own `query_log`
rows (`is_initial_query = 0`, `current_database = 'default'`), which the
test's `current_database = currentDatabase()` filter drops, so the
initiator row shows `CachedReadBufferReadFromCacheBytes = 0` and the
throttler check compares `0 <= 0`.

Observed in the failing job's `query_log` (PR ClickHouse#124753, arm_binary
ParallelReplicas): the initiator read 0 marks, the two remote rows read
1 + 28 marks with 12268 + 1409476 cache bytes.

Pin `enable_parallel_replicas = 0` on the measured read only, as ClickHouse#124528
did for the columns cache tests, so both columns are evaluated on the row
that did the read. The warm-up read is unchanged: the replicas are the
same server process and warm the same filesystem cache.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. 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-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. 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