Skip to content

Fix flaky test 05394_filesystem_cache_slru_promote_partial_segment - #126174

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-flaky-05394-slru-mark-file-promotions
Oct 16, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-flaky-05394-slru-mark-file-promotions

Conversation

@groeneai

@groeneai groeneai commented Oct 16, 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):

Not required.

Description

Related: #125657

Failure: Stateless tests (arm_binary, parallel) on PR #107567: -scan 0 0 1 / +scan 1 0 1, so the scan counted 2 promotions where the test expects none. The same diff appeared at 3 commits of #125657's own CI.

The 128 MiB test mark cache is shared with all concurrently running tests. When it evicts this table's marks between second_1 and scan, the scan reloads key.cmrk2 and value.cmrk2 through the test's filesystem cache. first_1 downloaded each of them as one complete segment in the probationary queue, so the scan's hits promote both. The failing run's query_log shows exactly that: the scan has MarkCacheMisses = 2, LoadedMarksFiles = 2, and the only 898 bytes it read from the cache are the two mark files.

The check now counts FilesystemCachePromotedFileSegments - LoadedMarksFiles. A mark file load reads one small file, so it promotes at most one segment, and the difference never exceeds the data-segment promotions. When no marks are reloaded, the check is unchanged.

Validation (debug build):

  • SYSTEM DROP MARK CACHE before the scan: the unchanged test fails 21/21 with the CI diff and the CI's counters; the fixed test passes 11/11.
  • A loop dropping the mark cache every ~0.5 s: unchanged 11/100 FAIL (+scan 1 0 1), fixed 50/50 OK, with 8 of those scans hitting the trigger.
  • A query that re-reads downloaded data segments still gives promoted = 1 under the new check. 50/50 OK without the loop.

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

Version info

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

The test mark cache (128 MiB) is shared with all concurrently running
tests. When it evicts the table's marks between `second_1` and `scan`,
the scan reloads `key.cmrk2` and `value.cmrk2` through the test's
filesystem cache. `first_1` downloaded each of them as one complete
segment in the probationary queue, so the scan's hits promote both and
the scan row reads `scan 1 0 1`. The failing CI run's query_log shows
it: the scan has MarkCacheMisses = 2, LoadedMarksFiles = 2, Promoted = 2,
and the only 898 bytes it read from the cache are the mark files.

Subtract LoadedMarksFiles from the promotion count. One mark file load
reads one small file and promotes at most one segment, so the difference
never exceeds the data-segment promotions; without a mark reload the
check is unchanged. UInt64 - UInt64 is Int64, so a reload of marks that
are already protected gives a negative value, not a wrap-around.

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

Copy link
Copy Markdown
Collaborator Author
Internal review before publication: 0 blocking findings

Own review and a second-model review of 0fe252616fd49: no blockers or majors.

Finding Verdict
💡 The description quoted 20/20 and 10/10 for the injected repro; the recorded runs are 21/21 and 11/11 Fixed in the description

@clickhouse-gh

clickhouse-gh Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [0fe2526]

Summary: ✅


AI Review

Summary

PR #126174 (0fe252616fd4) fixes the flaky 05394_filesystem_cache_slru_promote_partial_segment test by discounting mark-file loads from the filesystem-cache promotion assertion. No actionable findings.

Missing context / blind spots
  • ⚠️ Runtime validation relies on the forced-eviction reproductions and repeated runs documented in the PR. No local ClickHouse binary/build was available, and the fetched CI reports did not expose a result for this specific test.
Final Verdict

Status: ✅ Approve.

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

Copy link
Copy Markdown
Collaborator Author

cc @CheSema, could you review this? When the shared mark cache evicts the table's marks, the scan in 05394 reloads both mark files through the test's filesystem cache and promotes their segments, so the check now subtracts LoadedMarksFiles from FilesystemCachePromotedFileSegments.

@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Oct 16, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Oct 16, 2026
@alexey-milovidov alexey-milovidov self-assigned this Oct 16, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 16, 2026
Merged via the queue into ClickHouse:master with commit 923af96 Oct 16, 2026
353 of 354 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 16, 2026
JTCunning pushed a commit to JTCunning/ClickHouse that referenced this pull request Oct 17, 2026
PedroTadim pushed a commit that referenced this pull request Oct 20, 2026
…ents"

Reverts #125657 and its test fix #126174: suspected of breaking CI.
opensource-fork-sync Bot pushed a commit to cla7aye15I4nd/opensource-ClickHouse__ClickHouse that referenced this pull request Nov 3, 2026
@clickhouse-gh clickhouse-gh Bot added comp-filesystem-cache Filesystem cache for remote/object storage, page cache, and read caching infrastructure. 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-filesystem-cache Filesystem cache for remote/object storage, page cache, and read caching infrastructure. 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