Skip to content

Fix flaky test 03254_prewarm_mark_cache_rmt with the columns cache - #127866

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/03254-prewarm-rmt-columns-cache
Oct 28, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/03254-prewarm-rmt-columns-cache

Conversation

@groeneai

@groeneai groeneai commented Oct 26, 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 03254_prewarm_mark_cache_rmt, which failed with a randomized use_columns_cache = 1 since the columns cache also serves compact parts.

Description

03254_prewarm_mark_cache_rmt fails with reference line 15 1 -> 0 since #127287 merged, on unrelated PRs (amd_debug report, arm_binary report). Both runs drew use_columns_cache, enable_reads_from_columns_cache and enable_writes_to_columns_cache = 1 with compact parts.

The read right after ATTACH fills the columns cache, and SYSTEM CLEAR MARK CACHE does not drop it. The next SELECT ... WHERE NOT ignore(*), the test's check that a read after clearing the mark cache loads marks, is then served from the columns cache and requests no marks. Only the compact reader's speculative async marks load can still count LoadedMarksCount, and it is cancelled when the reader finishes first.

The test now sets use_columns_cache = 0, as 2376801 did for the sibling 03254_prewarm_mark_cache_columns. A session SET wins over the runner's injected value and also holds in lanes without randomization.

Validation on a master debug build that contains #127287: with the three cache settings, load_marks_asynchronously = 0 and compact parts, the unmodified test fails 10/10 with the CI diff (the 7th SELECT has 15 columns cache hits and loads 0 marks); with the exact CI settings of the amd_debug report it fails 80/90, each time with the async marks task cancelled. With the fix it passes 10/10 and 90/90 with 0 columns cache hits or misses and marks loaded by the 7th SELECT every time; 50/50 randomized runs and a no-randomization run pass. The sibling 03985_prewarm_index_mark_cache passes 20/20 under the same settings while the cache serves its data (its index marks are loaded during index analysis), so it is unchanged.

🤖 Generated with Claude Code


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

Version info

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

Since ClickHouse#127287 the columns cache also serves compact parts. The runner
randomizes `use_columns_cache` + `enable_reads_from_columns_cache` +
`enable_writes_to_columns_cache`. When all three are on and the parts are
compact, the read after ATTACH fills the cache (DETACH destroys the parts
and removes their entries), and `SYSTEM CLEAR MARK CACHE` does not drop it.
The next `SELECT ... WHERE NOT ignore(*)`, the test's positive control
("a read after clearing the mark cache loads marks"), is then served
entirely from the columns cache and requests no marks. Only the
speculative async marks load scheduled by the compact reader can still
count `LoadedMarksCount`, and it is cancelled when the reader finishes
first, so the reference `1` becomes `0` in a fraction of runs. Under the
same settings the expected-0 "prewarm worked" rows are vacuous, since a
cache-served read loads no marks either way.

Disable the columns cache for the whole test, as 2376801 did for
the sibling 03254_prewarm_mark_cache_columns. A session SET beats the
runner's injected value and also holds where randomization is off.

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; 2 findings).

# Sev Finding Verdict Evidence / action
1 ⚠️ The row after SYSTEM PREWARM MARK CACHE cannot detect a no-op prewarm, since the 7th SELECT already caches the marks DISAGREE (out of scope) Pre-existing since the test was added and independent of the columns cache; SYSTEM PREWARM MARK CACHE is checked by 03254_system_prewarm_mark_cache (clear, prewarm, read)
2 ⚠️ 03254_system_prewarm_mark_cache is vacuous when the randomized columns cache is on DISAGREE Not failing: its positive read is of a fresh part (cache empty), 0 failures in CIDB since #127287; the cache-served row only occurs in 1 of 8 random draws

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

Session id: cron:clickhouse-review-slot-8:20261026-172500

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. tests/clickhouse-test 03254_prewarm_mark_cache_rmt --test-runs 10 --settings "--use_columns_cache 1 --enable_reads_from_columns_cache 1 --enable_writes_to_columns_cache 1 --load_marks_asynchronously 0" --merge-tree-settings "--min_bytes_for_wide_part 1073741824" fails 10/10 on a master debug build with the CI diff. The exact CI settings of the amd_debug report fail 80/90.
b Root cause explained? Since #127287 the columns cache serves compact parts. The read after ATTACH fills it and SYSTEM CLEAR MARK CACHE does not drop it, so the positive-control SELECT is served from the cache (15 hits) and requests no marks; the speculative async marks load is cancelled when the reader finishes first (80/80 failing runs).
c Fix matches root cause? Yes. SET use_columns_cache = 0 removes the cache from every read of the test, so the mark-cache assertions measure the mark cache again. No widened bound, no blanket tag; same form as 2376801 for the sibling test.
d Test intent preserved / new tests added? Yes. All 8 rows measure marks again: 0 columns cache hits or misses in every fixed run, and the positive control loads marks in 100/100. .reference unchanged. Test-only fix.
e Both directions demonstrated? Yes. Unmodified: 10/10 and 80/90 FAIL. Fixed: 10/10 and 90/90 OK, plus 50/50 randomized and a no-randomization run OK.
f Fix is general across code paths? N/A for product code. Sibling 03985_prewarm_index_mark_cache passes 20/20 under the same settings (index marks load during index analysis); the others read fresh parts or already pin the setting.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test setting fix). The SET disables the cache for compact and wide parts alike; randomized MergeTree settings covered by the 50/50.
h Backward compatible? (maintainer-approved exception only) N/A, no product change.
i Invariants and contracts preserved? N/A, no product change.

Session id: cron:clickhouse-impl-slot-7:20261026-171000

@clickhouse-gh

clickhouse-gh Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ea55f64]

Summary: ✅


AI Review

Summary

PR #127866 disables use_columns_cache in 03254_prewarm_mark_cache_rmt so reads exercise the mark cache instead of bypassing it through cached columns. The change preserves the existing assertions and is supported by the reported before/after reproductions. No actionable findings.

Final Verdict

Status: ✅ Approve.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Oct 26, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @rschu1ze, could you review this and add the can be tested label so CI runs? Since #127287 the columns cache also serves compact parts, so the test's check that a read after SYSTEM CLEAR MARK CACHE loads marks is served from the cache and loads none; the test now sets use_columns_cache = 0, like 2376801 did for 03254_prewarm_mark_cache_columns.

@alexey-milovidov alexey-milovidov self-assigned this Oct 28, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 28, 2026
Merged via the queue into ClickHouse:master with commit 8ea1384 Oct 28, 2026
526 of 528 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 28, 2026
@clickhouse-gh clickhouse-gh Bot added comp-part-formats Formats of MergeTree data parts in the public repository, that is how a part is laid out on disk ... 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-part-formats Formats of MergeTree data parts in the public repository, that is how a part is laid out on disk ... 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