Repository navigation
test(e2e): flush LRU access times by restart, not by sleeping - #230
Merged
Merged
Conversation
The eviction suite's LRU protection check slept 8s hoping the accessUpdater had persisted the read bumps before eviction ran. That raced on CI seven times in three days across four PRs: the flush is not bounded by the ticker period — updates are time-gated into a batch and written asynchronously — so no sleep length is a guarantee. accessUpdater.Stop() drains the update channel and flushes unconditionally before the process exits, so a graceful restart IS the guarantee. The access index lives in RocksDB and survives restart (the suite's own Test 4 asserts exactly that), so the property under test is unchanged — only the synchronization is now deterministic. Also fixes restart_server dropping the first server flag: it passed server_args where start_server expects its cleanup argument, so the leading flag was swallowed. It now passes cleanup=false explicitly, which is also the only correct value for a restart. Verified: eviction suite run 4x locally, LRU and FIFO protection pass every time (previously reproducible flake on CI). Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01L5DLvDTo9dhD38YQXhHpU9 Signed-off-by: Ovais Tariq <[email protected]>
Greptile SummaryThis PR makes the eviction end-to-end test deterministic by restarting the server to flush queued LRU access-time updates instead of relying on a fixed sleep.
Confidence Score: 5/5The PR appears safe to merge, with no concrete changed-code failures identified. The restart now preserves the intended disk directory, reapplies the complete server configuration, and follows the shutdown path that drains queued access updates before reopening persisted eviction state. Important Files Changed
Reviews (1): Last reviewed commit: "test(e2e): flush LRU access times by res..." | Re-trigger Greptile |
|
🎉 This PR is included in version 1.11.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
ovaistariq
added a commit
that referenced
this pull request
Sep 7, 2026
… (#261) The access index orders entries by nanosecond and a put records its write time at that precision, but a read bump was queued as whole Unix seconds and rebuilt with time.Unix(sec, 0), i.e. at the START of its second. A key read at hh:mm:ss.8 therefore sorted before every key written at hh:mm:ss.1..ss.7 and was evicted ahead of them. That is the eviction e2e "Protection semantics" flake. The five protecting reads land in the same wall-clock second as the tail of the twenty setup writes whenever the writes are fast, and the failing CI run shows exactly that order: keys 6-9 evicted, then the "protected" 1-3, with 10-20 untouched. PR #230 made the flush deterministic via a graceful restart, but could not fix the timestamp being flushed. The updater now carries time.Time end to end (queue, time-gate LRU, index key), so a bump sorts after everything written before the read. SetAccessTime keeps its Unix-seconds signature for the integration harness. A new unit test pins the ordering and fails on main. Fixes #257
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Kills the eviction-suite flake that has failed CI seven times in three days across four PRs (#216, #219, #228, #229), each time costing a rerun cycle.
Why the sleep could never work
The check reads the oldest keys to bump their LRU recency, then triggers eviction and asserts the bumped keys survived. It waited with
sleep 8for "a few flush intervals". But the bumps are queued by the read path and persisted asynchronously — the batch is time-gated (accessTimeLRU+DefaultAccessUpdateDelay) and written by a background ticker — so the delay is not bounded by the ticker period. No sleep length is a guarantee; CI simply lost the race periodically.The deterministic replacement
accessUpdater.Stop()drains the update channel and flushes unconditionally before the process exits:So a graceful restart is the guarantee — no timing assumption at all. The access index lives in RocksDB and survives restart (the suite's own "Restart persistence" test asserts exactly that property), so what's under test is unchanged; only the synchronization becomes deterministic.
Also fixed
restart_serverpassedserver_argswherestart_serverexpects itscleanupargument, so the first server flag was silently swallowed — a latent bug that would have dropped-diskfrom the restarted command line. It now passescleanup=falseexplicitly, which is also the only correct value for a restart.Verification
Eviction suite run 4× locally: LRU and FIFO protection pass every time, all 8 subtests green.
🤖 Generated with Claude Code
https://claude.ai/code/session_01L5DLvDTo9dhD38YQXhHpU9
Note
Cursor Bugbot is generating a summary for commit 2ffac0d. Configure here.