Repository navigation
Implemented SIEVE eviction in cache framework - #123435
Conversation
# Conflicts: # src/Common/CacheBase.h # tests/config/install.sh # tests/docker_scripts/stateless_runner.sh # tests/docker_scripts/stress_runner.sh
Mark the `assertQueue` test helper as `static` so it does not trigger `-Werror,-Wmissing-prototypes`, and take `expected_keys` by const reference. Co-Authored-By: Claude Opus 4.8 <[email protected]>
List the supported cache eviction policies (`LRU`, `SLRU`, `SIEVE`) in the descriptions of the `uncompressed_cache_policy`, `mark_cache_policy`, `index_uncompressed_cache_policy` and `index_mark_cache_policy` server settings, and in the documentation of the filesystem cache `cache_policy` setting. Co-Authored-By: Claude Opus 4.8 <[email protected]>
The columns cache is `CacheBase`-backed and is live by default (it is sized by `columns_cache_size_to_ram_ratio`), so randomizing its policy, including `SIEVE`, and its `columns_cache_size_ratio` gives it the same coverage as the other caches. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=123435&sha=30bded508da21d41e57e933e3f8f3d81338e9b51&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20ParallelReplicas%2C%20s3%20storage%2C%20parallel%29 ( Other failures: |
|
Not caused by this PR. The fix is #123121 (mine, open). This run fails query 26 of the test with |
With parallel replicas the order in which rows reach `GROUP BY` depends on the coordinator's assignment of ranges, so `group_by_overflow_mode = 'any'` with `max_rows_to_group_by = 100` keeps a different set of keys (e.g. 32560..32569 instead of 0..9). The test was blacklisted for parallel replicas before (ClickHouse#90858) and re-enabled in `ab50bbc1a4d`. CI report: https://s3.amazonaws.com/clickhouse-test-reports/PRs/123435/30bded508da21d41e57e933e3f8f3d81338e9b51/pr/result_stateless_tests_arm_binary_parallelreplicas_s3_storage_parallel.json PR: ClickHouse#123435 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Thanks @groeneai. The other red job, I merged the latest |
|
📊 Cloud Performance Report ✅ AI verdict: no significant changes detected. K_source=6 K_base=30 flagged=0/65 clickbench🟢 No significant changes tpch_adapted_1_official🟢 No significant changes Debug info
|
alexey-milovidov
left a comment
There was a problem hiding this comment.
The literature suggests that SIEVE is unlikely to be better than SLRU.
However, the implementation is compact and clean, and it will improve our capabilities for further generalization and experimentation.
Good to merge.
…r-part Conflicts: - `src/Storages/MergeTree/MergeTreeData.cpp`, `MergeTreeData.h`: master changed the old statistics refresh task (`startStatisticsCache` / `stopStatisticsCache` / `refreshStatistics`, #125165) so that shutdown does not wait for a running refresh. This PR removes that task entirely in favor of the per-part cache, so the removal is kept. Its test `05361_statistics_refresh_does_not_block_drop` exercises only the removed task and `refresh_statistics_interval` (now obsolete), so it is deleted. - `src/Core/ServerSettings.cpp`: kept the `statistics_cache_*` settings and took master's new description of `iceberg_metadata_files_cache_policy`; the description of `statistics_cache_policy` now lists the possible values like the other cache policies after #123435.
…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]>
Implements the
SIEVEcache eviction policy in the cache framework (CacheBase), available alongside the existingLRUandSLRUpolicies.SIEVEis a simple, scan-resistant eviction algorithm: a single "hand" walks a FIFO queue of entries and evicts the first entry whosevisitedflag is clear, clearing the flag as it passes set entries. See the paper for details: https://junchengyang.com/publication/nsdi24-SIEVE.pdfThis continues the original work by @Vectorshine, brought up to date with
master:SIEVECachePolicyto match the currentICachePolicyinterface (CurrentMetricstracking,maxCount,contains, per-entryOnRemoveEntryFunction), mirroringLRUCachePolicy.removewhere the stored queue iterator was advanced in place and the wrong node was erased.gtest_sieve_cache.cpp, including a step-by-step test of the eviction logic.LRU,SLRUandSIEVEin stateless functional tests (ci/jobs/functional_tests.py) and the stress test (tests/docker_scripts/stress_runner.sh).SIEVEis only implemented for theCacheBase-backed caches, so the filesystem cache (backed byFileCachePolicy) is not randomized to it, and it is excluded during bugfix validation, which runs downloaded master-side binaries.This supersedes #62756 (original work by @Vectorshine, whose commits are preserved here): that PR's head is the fork's
masterbranch, and merging the currentmasterinto it cannot be pushed there because the merge touches.github/workflowsand the available token lacks theworkflowscope.Closes: #58910
Related: #62756
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Added a new cache eviction policy
SIEVE. It can be selected for the in-memory caches backed byCacheBase, such as the mark cache and the uncompressed cache, via the corresponding*_cache_policyserver settings (for example,mark_cache_policyanduncompressed_cache_policy). It is not available for the filesystem cache.Documentation entry for user-facing changes
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/123435]
Version info
26.10.1.2241-master(included in26.10and later)