Skip to content

Fix flaky test 05218_text_index_substreams_opened_lazily with the columns cache - #127781

Merged
devcrafter merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-flaky-05218-text-index-columns-cache
Oct 27, 2026
Merged

devcrafter merged 2 commits into
ClickHouse:masterfrom
groeneai:fix-flaky-05218-text-index-columns-cache

Conversation

@groeneai

@groeneai groeneai commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #127287

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):

Fix the flaky test 05218_text_index_substreams_opened_lazily, which failed with a randomized use_columns_cache = 1 since the columns cache also serves compact parts.

Description

05218_text_index_substreams_opened_lazily fails with in_range_above_threshold 1 -> 0 since #127287 merged: 10 times within 2.5 hours, in the arm_binary, amd_debug and amd_msan sequential stateless jobs, on 9 unrelated PRs and on master (master report, PR report). The runner's own diagnosis names --use_columns_cache 1 as the culprit.

The test's table uses compact parts. Since #127287 the columns cache serves compact parts too, so with a randomized use_columns_cache = 1 the unmeasured warm-up query caches the columns and the measured queries open no data files. The in-range control then opens only the 30 postings files (FileOpen 30, ColumnsCacheHits 30), not more than PARTS, and the selective and postings-cached arms pass without exercising lazy substream opening at all (0 files opened).

The test now pins use_columns_cache = 0 next to its existing query cache and query condition cache pins, in the settings that every measured query and warm-up uses. With the setting at 0 the cache is neither read nor written.

Validation on a debug build of master ae5c82b2ad2: with --client-option use_columns_cache=1 enable_reads_from_columns_cache=1 enable_writes_to_columns_cache=1 and no other randomization, the unmodified test fails 5/5 with the CI diff. With the pin it passes 5/5 (0 cache hits, in-range FileOpen 60), and removing the pin brings the failure back 5/5. 50/50 randomized runs pass, 7 of which drew the failing combination. A pre-#127287 master build passes the forced runs 5/5 with no cache hits.

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.826-master (included in 26.11 and later)

Since ClickHouse#127287 the columns cache serves compact parts, so with a
randomized `use_columns_cache = 1` the warm-up query caches the columns
and the measured queries open no data files. That turns the FileOpen
oracle blind: the in-range control fails (FileOpen 30, not > PARTS), and
the selective and postings-cached arms pass vacuously (0 files opened).

Pin `use_columns_cache = 0` in the settings every measured query and
warm-up uses, next to the query cache pins. With the setting at 0 the
cache is neither read nor written, so the `enable_reads_from_columns_cache`
and `enable_writes_to_columns_cache` draws need no pin.

Failing job: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=127715&sha=9500cdadc54b2d1ef5c3825d11b4d749668a5fd2&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20sequential%29

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

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 of the diff (1 nit).

# Sev Finding Verdict Evidence / action
1 💡 The uncompressed cache (use_uncompressed_cache, also randomized) opens data files lazily, so it could in principle remove counted opens too DISAGREE Not a carrier for this fixture: 0 failures of this test in 2,000+ randomized CI runs before #127287, every failure since then has use_columns_cache = 1 as the culprit, and 50/50 randomized local runs pass with the pin. No change.

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

Session id: cron:clickhouse-review-slot-9:20261025-144200

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Debug build of master ae5c82b2ad2, tests/clickhouse-test 05218_text_index_substreams_opened_lazily --no-random-settings --no-random-merge-tree-settings --test-runs 5 --client-option use_columns_cache=1 enable_reads_from_columns_cache=1 enable_writes_to_columns_cache=1: 5/5 FAIL with the CI diff.
b Root cause explained? Since #127287 the columns cache serves compact parts. With use_columns_cache = 1 the warm-up caches the columns, so the measured in-range query opens only the 30 postings files (FileOpen 30, ColumnsCacheHits 30) and the FileOpen > PARTS control fails.
c Fix matches root cause? Yes. The cache that removes the counted opens is pinned off at query level, like the query cache pins already there. No threshold, tag or fixture change.
d Test intent preserved / new tests added? Yes. All assertions unchanged. With the cache, the selective and postings-cached arms opened 0 files and passed vacuously; the pin restores what they test.
e Both directions demonstrated? Yes, same binary: unmodified 5/5 FAIL, pinned 5/5 OK (0 cache hits, in-range FileOpen 60), pin removed 5/5 FAIL. 50/50 randomized OK.
f Fix is general across code paths? All 3 measured queries and both warm-ups use the pinned settings string.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test setting fix). use_columns_cache = 0 also disables cache reads and writes, so the enable_reads/writes draws need no pin.
h Backward compatible? (maintainer-approved exception only) N/A (test only). A query-level pin also holds if the setting's default changes.
i Invariants and contracts preserved? N/A (no source change).

Session id: cron:clickhouse-impl-slot-6:20261025-142400

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @Ergus, could you review this and add the can be tested label so CI runs? Since #127287 the columns cache also serves compact parts, so a randomized use_columns_cache = 1 lets the measured queries in this test open no data files and the FileOpen control fails; the test now pins use_columns_cache = 0 next to its other cache pins.

@clickhouse-gh

clickhouse-gh Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [4649977]

Summary: ✅


AI Review

Summary

This PR pins use_columns_cache = 0 for every warm-up and measured query in 05218_text_index_substreams_opened_lazily, preserving its FileOpen assertions when client settings enable the columns cache. No actionable findings. The affected test passes in ARM CI at abf2e198; the subsequent commit only adds an explanatory comment.

Final Verdict

Status: ✅ Approve

@devcrafter

devcrafter commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

@groeneai please add comment (concise, short one) in the test why use_columns_cache setting has been pinned

…ed_lazily

Requested by a reviewer on ClickHouse#127781.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author

Added in 4649977: a column served from the columns cache opens no data file, which blinds the FileOpen counts the test asserts on.

@devcrafter
devcrafter enabled auto-merge October 26, 2026 21:18
@devcrafter
devcrafter added this pull request to the merge queue Oct 26, 2026
Merged via the queue into ClickHouse:master with commit ff013fe Oct 27, 2026
178 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 27, 2026
otselnik added a commit to otselnik/ClickHouse that referenced this pull request Oct 27, 2026
Merge upstream `master` at 9a348d8.
Include the fix that disables `use_columns_cache` in the text-index
file-opening regression test. Preserve the existing `DDL` parser changes
and their regression coverage.

Related: ClickHouse#127781
Related: ClickHouse#117678
UberDever added a commit to UberDever/ClickHouse that referenced this pull request Oct 27, 2026
Retain upstream statistics-loader headers alongside the cancellation context include. Include the columns-cache isolation fix for the text-index file-open test.

Related: ClickHouse#127781
@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... 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