Repository navigation
Implemented SIEVE eviction in cache framework - #62756
Vectorshine wants to merge 61 commits into
Conversation
|
This is an automatic comment. The PR descriptions does not match the template. Please, edit it accordingly. The error is: More than one changelog category specified: 'Improvement', 'Performance Improvement' |
1 similar comment
|
This is an automatic comment. The PR descriptions does not match the template. Please, edit it accordingly. The error is: More than one changelog category specified: 'Improvement', 'Performance Improvement' |
|
This is an automated comment for commit 21fce56 with description of existing statuses. It's updated for the latest CI running ✅ Click here to open a full report in a separate page Successful checks
|
|
Let's add the cache policy to randomization in our functional tests. |
kssenii
left a comment
There was a problem hiding this comment.
You can add randomization of cache policies in CI similar to
ClickHouse/docker/test/stress/run.sh
Lines 73 to 88 in 38a0edd
cache_policy setting in storage_conf.xml you should change the mark_cache_policy in another server config. We do not yet have it explicitly enabled in CI, so you'll also need to add a file with this setting to ClickHouse/tests/configs/config.d/. Also do not forget to add an according file installation into ClickHouse/tests/config/install.sh
|
reopen |
|
@Vectorshine, what happened? |
|
@Vectorshine Thanks for checking. There is no need to close and re-open this PR over and over 😄 I just started CI to see how the tests respond. |
Address review feedback: the correctness fix in `SIEVECachePolicy::remove` (advancing `hand` when it points at the erased queue node) was not covered by any test, so it could regress silently. `SIEVECache.RemoveEntryUnderHand` removes the entry the hand points at and asserts both the remaining queue order and the hand's new position, checks that removing an unrelated entry leaves the hand alone, covers the predicate overload of `remove`, and verifies that eviction still starts from the new hand position. `SIEVECache.RemoveLastEntryUnderHand` covers the wrap-around case where the removed entry is the last one in the queue, and that the cache stays usable after the queue is emptied through `remove`.
LLVM Coverage Report
|
Build profile diff (arm_release)Comparing commit See the job log for details. |
|
🕵 Regenerated the affected server-settings reference entries from the updated |
🛑 Locadex CancelledNew changes were pushed while a Locadex run was in progress, so that run was cancelled. Comment |
Reconstructed the merge because the fork branch has two merge bases with master (criss-cross), which makes a plain `git merge` manufacture spurious conflicts in unrelated files. The net diff against master is unchanged: the SIEVE cache policy files, the `*_cache_policy` server-setting descriptions and their generated docs pages, and the cache-policy randomization in the test jobs.
The mark and uncompressed cache randomization added by this pull request replaced the existing `storage_conf` `<cache_policy>` randomization instead of sitting next to it, so the stress test stopped exercising the `SLRU` filesystem cache. The filesystem cache is backed by `FileCachePolicy`, which has no `SIEVE` value, so it gets its own `LRU`/`SLRU` variable, as `functional_tests.py` already does.
Merged with explicit recent merge base 66e8bc0 to avoid spurious conflicts from the criss-cross merge history (two merge bases).
…_policy` settings in Dolor `tests/casa_del_dolor/properties.py` only chose between `LRU` and `SLRU` for the 17 `*_cache_policy` server settings, so the random-server-settings run never exercised `SIEVE` on those entrypoints. All 17 are `CacheBase`-backed, so `SIEVE` is valid for each of them. The filesystem cache generator is left alone because it is backed by `FileCachePolicy`, which has no `SIEVE`. Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
🕵 Superseded by #123435, which keeps all the original commits and adds a merge of the current |
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.Closes: #58910
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
Workflow [PR]
Sync PR [sync-upstream/pr/62756]