Skip to content

Keep the ProfileEvents-checked reads of the string filter tests off parallel replicas - #124911

Merged
azat merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/string-filter-profile-events-off-parallel-replicas
Oct 9, 2026
Merged

azat merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/string-filter-profile-events-off-parallel-replicas

Conversation

@groeneai

@groeneai groeneai commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

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

Three string filter tests assert StringValueFilter* ProfileEvents of one read from system.query_log and sometimes read 0 in the ParallelReplicas lane, e.g. 05055_string_filters_move_to_prewhere on #124776: report. In 30 days of Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel), which runs on every PR since #123790: 05233_string_filters_fixed_string_constant failed 7 of 52 runs, 05055_string_filters_during_scan_merge_tree 4 of 52, 05055_string_filters_move_to_prewhere 3 of 52. The coverage lane relabels such failures as OK (14 more there, one on master).

The lane enables parallel replicas for every query, so a remote replica on the same server sometimes reads all marks of the measured read. It counts the events on its own query_log row (current_database = 'default'), which the tests' current_database = currentDatabase() filter drops. The failing jobs' query_log artifacts confirm it: each initiator row with 0 had a secondary row carrying the events.

The change runs only the measured reads with enable_parallel_replicas = 0, as #124528 did for the columns cache tests; the other reads keep running under parallel replicas in that lane. 05325_string_filters_columns_cache_guard has the same oracle but asserts 0, so in that lane it passed whatever the guard did; it is pinned too. No reference changes.

Validation on a local ParallelReplicas rig, same binary: unmodified, the three tests fail 13 of 90 runs, and 48 of 60 with a failpoint that delays the local replica; fixed, all four pass 120/120 and 80/80, plus 200/200 with randomized settings and no parallel replicas.


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

Version info

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

…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]>
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-own-pr PR origin: CI on a groeneai PR exposed a separate defect labels Oct 9, 2026
@groeneai

groeneai commented Oct 9, 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 💡 Not in this PR: 05345_string_filters_during_scan_merge_tree_short_values_bulk_scan in open #124507 reads StringValueFilterValuesReplaced from query_log for a MergeTree read without the pin, so it can hit the same 0 in the ParallelReplicas lane once merged. AGREE, noted, not blocking Not on master; out of scope here.

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-10:20261009-124400

@groeneai

groeneai commented Oct 9, 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, the three unmodified tests fail 5/5 each on the measured line.
b Root cause explained? A remote replica reads the marks; its ProfileEvents land on its own query_log row (current_database = 'default'), so the initiator row the test reads is 0.
c Fix matches root cause? Yes: only 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 the measured read fails exactly that line (6/10). Other reads still use parallel replicas.
e Both directions demonstrated? Yes, same binary: unmodified 13/90 fail as is, 48/60 with a failpoint delaying the local replica; fixed 120/120 and 80/80 pass.
f Fix is general across code paths? Every master test reading StringValueFilter* events from query_log is covered: 3 failing ones and 05325 (asserts 0, blind in that lane) pinned; 05227 was already pinned by its author; the Parquet tests do not use parallel replicas.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only; the pin is a no-op without parallel replicas, 200/200 randomized).
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-40:20261009-121900

@clickhouse-gh

clickhouse-gh Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [cbfc4e1]

Summary: ❌

job_name test_name status info comment
Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 1/2) FAIL
05316_secret_arguments_declared_by_engines FAIL cidb

AI Review

Summary

This PR makes four ProfileEvents-based stateless string-filter tests deterministic in the ParallelReplicas lane by forcing only the specific oracle reads to run with enable_parallel_replicas = 0, so the checked system.query_log rows stay on the initiator. I reviewed the current diff, the surrounding test logic, the prior PR discussion, and the existing related tests, and I do not see a correctness or coverage regression in the change as written.

Final Verdict
  • Status: ✅ Approve

@groeneai

groeneai commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - cbfc4e1

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
Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 1/2) / 05316_secret_arguments_declared_by_engines test regression from merged #123364, not from this PR (which only changes four string-filter tests): under DatabaseReplicated the CREATE DICTIONARY row is counted twice in system.query_log (0 2 instead of 0 1, the password stays hidden). The same diff is on almost every PR in this lane since 2026-10-09 09:47Z #124928 (external, open)
Mergeable Check, PR praktika rollups of the row above #124928 (external, open)

The four changed tests passed in every lane that ran them, including Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel) and all five flaky checks (amd_asan_ubsan, amd_binary, amd_debug, amd_msan, amd_tsan).

Session id: cron:our-pr-ci-monitor:20261009-170013

@azat
azat disabled auto-merge October 9, 2026 18:13
@azat
azat added this pull request to the merge queue Oct 9, 2026
Merged via the queue into ClickHouse:master with commit d0c6d55 Oct 9, 2026
161 of 164 checks passed
@robot-ch-test-poll robot-ch-test-poll added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 9, 2026
diegomestre2 pushed a commit to diegomestre2/ClickHouse that referenced this pull request Oct 16, 2026
…d_step_order off parallel replicas

The test compares `RowsReadByPrewhereReaders` with `SelectedRows` on the
initiator's `query_log` row. In the `ParallelReplicas` lane the initiator's
`SelectedRows` covers the whole read, while a remote replica that wins marks
counts its reads on its own row (`current_database = 'default'`), which the
`current_database = currentDatabase()` filter drops. The numerator then
shrinks and `read_order_index_first` flips from 0 to 1. Initiator plus
remote rows always give the expected ratio, so the replicas read in the
same PREWHERE step order.

Run only the four measured reads with `enable_parallel_replicas = 0`, as
ClickHouse#124911 did for the string filter tests; the other reads keep running under
parallel replicas in that lane.

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-own-pr PR origin: CI on a groeneai PR exposed a separate defect 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