Skip to content

Fix flaky test 04266_text_index_tokens_cardinality_order with parallel replicas - #123688

Closed
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:fix-flaky-04266-text-index-parallel-replicas
Closed

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:fix-flaky-04266-text-index-parallel-replicas

Conversation

@groeneai

@groeneai groeneai commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

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

Related: #122853

04266_text_index_tokens_cardinality_order is flaky in Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel), the PR-only lane added by #122853: 7 failed and 39 passed runs as of 2026-10-03, the failures on 7 unrelated PRs, for example PR #123531. The output has the expected three Reading tokens ... from part lines, then 2 or 3 extra ones.

The test greps the client's send_logs_level = 'test' output and expects one index analysis over the three parts. In this lane the server profile enables parallel replicas. When the coordinator gives parts to a follower replica, the follower reads the text index tokens again with its own empty cardinality cache, and its log lines are forwarded to the client. Whether a follower gets parts depends on timing, so reruns pass.

The change sets enable_parallel_replicas = 0 in the SETTINGS of the one logged query. The rest of the test, including the first count(), still runs with parallel replicas in that lane.

Validation on a local server with the lane's three-replica loopback cluster (debug build):

  • unmodified test: 33/300 randomized runs fail with the CI diff; 80/80 fail with an 11-replica cluster;
  • fixed test: 0/300 and 0/100 on the same arms, 0/50 with parallel_replicas_local_plan = 0, 0/50 without parallel replicas;
  • system.query_log: the fixed query has no secondary queries. Removing only the new setting brings the failures back (80/80).

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

…l replicas

The test greps the client's `send_logs_level = 'test'` output for the
`Reading tokens ... from part ...` lines and expects one single-node index
analysis over the three parts. In the `ParallelReplicas` stateless lane the
server profile enables parallel replicas. When the coordinator hands parts to
a follower replica, the follower reads the text index tokens again with its own
empty cardinality cache, and its forwarded log lines add 2 or 3 lines after the
expected three. Which replica gets parts is a race, so reruns pass.

Two follower paths were observed: with the coordinator-only index analysis in
effect the follower reads only the parts it was given, at read time; when the
skip does not apply (for example with projection support active for count())
the used follower analyzes all three parts at plan time.

Pin `enable_parallel_replicas = 0` in the SETTINGS of the logged query only, so
the rest of the test keeps running with parallel replicas in that lane.

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) plus my own cold review (0 findings).
Nothing to adjudicate.

Session id: cron:clickhouse-review-slot-10:20261003-130052

@clickhouse-gh

clickhouse-gh Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [6d31790]

Summary: ❌

job_name test_name status info comment
Build (amd_fuzzers) FAIL
Build ClickHouse FAIL cidb

AI Review

Summary

This PR makes 04266_text_index_tokens_cardinality_order.sh deterministic in the ParallelReplicas stateless lane by disabling enable_parallel_replicas only for the one --send_logs_level=test query whose forwarded follower logs were making the expected three-line log sequence nondeterministic. I read the current script, the PR diff, and the existing PR discussion, and I do not see a remaining correctness, coverage, or metadata problem in the proposed change.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 3, 2026
@groeneai
groeneai requested a review from Ergus October 3, 2026 13:27
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 3, 2026
@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 6d31790

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 (test-only diff): clickhouse_fuzzer link fails with relocation R_X86_64_PC32 out of range (sanitizer_stackdepot.cpp.o -> .bss, 2148738730 > 2^31); the same link fails on master 4127c656 and on other PRs today #122521 (mine, open)
Mergeable Check, PR rollups, red only because of the row above #122521 (mine, open)

All 160 checks completed; CIDB has no other FAIL or ERROR row on this head.

Session id: cron:our-pr-ci-monitor:20261003-160141

@groeneai groeneai mentioned this pull request Oct 5, 2026
1 task done
@groeneai
groeneai requested a review from fm4v October 7, 2026 15:36
@fm4v

fm4v commented Oct 8, 2026

Copy link
Copy Markdown
Member

Superseded by #124500 (same one-line change).

@fm4v fm4v closed this Oct 8, 2026
@clickhouse-gh clickhouse-gh Bot added comp-text-index Full-text search: inverted/text index in MergeTree (tokenizers, posting lists, GIN-style index bu... 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-text-index Full-text search: inverted/text index in MergeTree (tokenizers, posting lists, GIN-style index bu... groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants