Skip to content

Fix flaky 00933_test_fix_extra_seek_on_compressed_cache under the SIEVE cache policy - #125561

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-00933-sieve-uncompressed-cache
Oct 13, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-00933-sieve-uncompressed-cache

Conversation

@groeneai

@groeneai groeneai commented Oct 13, 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: #123435 (randomized the cache policy).

Since #123435 merged, the test failed on 5 unrelated PRs (0 on master, 0 in these lanes in the week before), each time in a job whose log says Using mark/uncompressed cache policy: SIEVE, e.g. Stateless tests (arm_binary, sequential) and Stateless tests (arm_binary, AsyncInsert, s3 storage, sequential): the second, cached SELECT gave 0 400518 0 or 2 236474 5 instead of 0 0 13.

The 128 MiB uncompressed cache is shared by all tests of the job. When earlier tests leave it nearly full of entries that were already hit, the first eviction under SIEVE clears their visited bits and evicts this test's first new block. Every later insert then evicts the oldest new block, so the second read misses its blocks before it reaches them. LRU and SLRU keep the most recent blocks, which the test relied on. This is how SIEVE works, not a bug in it.

The test is no-parallel, so it now runs SYSTEM CLEAR UNCOMPRESSED CACHE before the first cached read, as 04326_json_advanced_shared_data_file_open does for the mark cache. The 13 blocks then fit without eviction under every policy. The assertion is unchanged.

Validation (debug build, 128 MiB caches pre-filled with 2035 blocks that were all hit): under SIEVE the old test failed 3/3 with exactly 0 400518 0 (on s3 storage 0 262466 5), and the new one passed 3/3. It also passed 20/20 runs each under SIEVE, SIEVE on s3 storage, and SLRU. With an 8 MiB pre-filled cache the old test failed 10/10 and the new one passed 50/50.


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

Version info

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

…ache policy

Since ClickHouse#123435 the functional test jobs pick the mark/uncompressed cache
policy at random from LRU, SLRU and SIEVE. The test reads 13 blocks once
with use_uncompressed_cache = 1 and expects the second read to hit all 13.

The CI uncompressed cache (128 MiB) is shared by all tests of the job.
When earlier tests leave it full of entries that were already hit, the
first insert that overflows makes the SIEVE hand clear all of those
entries and evict the test's own first block. After that every insert
evicts the oldest new block, so the second read misses blocks before it
reaches them (0 400518 0 in CI). LRU and SLRU keep the most recent
blocks, which the test relied on. This is how SIEVE is defined, not a
bug in it.

The test is no-parallel, so clear the uncompressed cache right before
the first cached read: the 13 blocks then fit with no eviction under
every policy.

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 13, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review: my own cold review of the diff plus one independent second-model pass (engine: codex). Both returned 0 findings.

Checked and found sound: the mark cache, also randomized to SIEVE, needs no clear (the entry the first read inserts is exempt from its own eviction, and nothing else inserts marks before the second read); no other writer reaches the uncompressed cache between the clear and the second read (no-parallel tests run after the parallel stage); the assertion 0 0 13 is unchanged; open #118790 edits a different line of this test.

Severity: ❌ blocker / ⚠️ major / 💡 nit. No findings to adjudicate.

Session id: cron:clickhouse-review-slot-8:20261013-051600

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. SIEVE uncompressed cache pre-filled with blocks that were all hit and less free room than the test's 13 blocks: old test failed 10/10 (8 MiB cache) and 3/3 via clickhouse-test (128 MiB, as in CI) with exactly 0 400518 0.
b Root cause explained? Yes. #123435 randomizes the cache policy; under SIEVE the first eviction clears all old (hit) entries and evicts the test's first new block, then every insert evicts the oldest new block, so the second read misses its blocks before reaching them. LRU/SLRU keep recent blocks.
c Fix matches root cause? Yes. The test establishes its own precondition (empty cache, SYSTEM CLEAR UNCOMPRESSED CACHE; the test is no-parallel) instead of relying on LRU/SLRU retention. No assertion change, no tag, no policy pin.
d Test intent preserved / new tests added? Yes. It still asserts no seek, no compressed read and 13 cache hits on the second read. Test-only change.
e Both directions demonstrated? Yes. Same binary and pre-state: old 10/10 and 3/3 FAIL, new 50/50 and 3/3 PASS; also 3/3 FAIL vs 3/3 PASS on s3 storage.
f Fix is general across code paths? 15 other tests asserting mark/uncompressed cache events: 0 failures in 840-1900 runs each since #123435; none needs more than one entry to survive across queries.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only). Passes under LRU, SLRU and SIEVE, on local disk and s3 storage (20/20 each).
h Backward compatible? (maintainer-approved exception only) N/A (test-only, no settings or format change).
i Invariants and contracts preserved? Between the clear and the second read nothing else writes the uncompressed cache: no-parallel, merges do not use it, INSERT/OPTIMIZE run before the clear.

Session id: cron:clickhouse-impl-slot-4:20261013-045100

@clickhouse-gh

clickhouse-gh Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [39694be]

Summary: ✅


AI Review

Summary

This PR makes 00933_test_fix_extra_seek_on_compressed_cache establish its own empty-cache precondition before the first cached read by issuing SYSTEM CLEAR UNCOMPRESSED CACHE. For a no-parallel stateless test that only asserts second-read UncompressedCacheHits, this is a targeted fix for the SIEVE-policy flake and I do not see a remaining correctness, safety, or test-contract issue in the current diff.

Final Verdict
  • Status: ✅ Approve

@alexey-milovidov alexey-milovidov self-assigned this Oct 13, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 13, 2026
Merged via the queue into ClickHouse:master with commit 570eaa9 Oct 13, 2026
178 checks passed
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 13, 2026
@clickhouse-gh clickhouse-gh Bot added comp-codecs Compression/encoding codecs (LZ4/ZSTD/etc.), archive formats (tar/zip/7z), codec selection and IO... 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-codecs Compression/encoding codecs (LZ4/ZSTD/etc.), archive formats (tar/zip/7z), codec selection and IO... 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