Skip to content

RED-213286: Extend BLESS eviction tests to every maxmemory policy - #15996

Merged
gabsow merged 3 commits into
redis:unstablefrom
LiranAbir:RED-213286-bless-eviction-policy-coverage
Oct 22, 2026
Merged

gabsow merged 3 commits into
redis:unstablefrom
LiranAbir:RED-213286-bless-eviction-policy-coverage

Conversation

@LiranAbir

@LiranAbir LiranAbir commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Test-only change to tests/unit/bless.tcl. It covers the eviction policies and paths that the BLESS suite added in #15649 didn't exercise yet. No server code changes.

What's added

Area Before After
Blessed key survives an eviction flood 6 of 9 evicting policies All 9 (adds volatile-lfu, volatile-lrm, allkeys-lrm)
All-blessed bounded overshoot (tolerated within 1.25x maxmemory, OOM past it, BLESS CLEAR relieves it) allkeys-random only, plus a separate allkeys-lru case All 9 evicting policies; keys get a TTL under volatile-*
Time-sliced eviction Not covered lazyfree-lazy-eviction yes with maxmemory-eviction-tenacity 0
No overshoot when no blessed key is an eviction candidate Not covered noeviction, and volatile-lru with blessed keys that have no TTL: the plain maxmemory limit applies

Most of the additions wrap existing tests in foreach loops rather than copying them. Per review, the loops sit at column 0 so the wrapped tests keep their original indentation (+51 / −9). A few existing test names gain a ($policy) or (lazyfree-lazy-eviction ...) suffix.

Note on the "no overshoot" case

The eviction docs say the overshoot tolerance "applies uniformly across every maxmemory-policy value". In the code, the tolerance only applies when eviction sampled keys and found that all of them were blessed (blessed_blocked). With noeviction, or under volatile-* when the blessed keys have no TTL, nothing is sampled, so writes get a plain OOM. The new test pins the current code behavior. If that's the intended behavior, the docs wording could be narrowed.

Testing

./runtest --single unit/bless on unstable @ 5e332ca (macOS arm64): all 48 cases pass, plus the memory-leak checks.

Found while working on RED-213286 (BLESS OSS test coverage).

🤖 Generated with Claude Code


Note

Low Risk
Changes are limited to unit tests in bless.tcl with no production code paths modified.

Overview
Test-only expansion of tests/unit/bless.tcl maxmemory/BLESS eviction scenarios—no server changes.

The memory-pressure case now runs for both lazyfree-lazy-eviction no and yes (with maxmemory-eviction-tenacity 0 on the lazy path), and several tests call config resetstat so evicted_keys assertions are not polluted by earlier cases.

All-blessed 1.25× overshoot behavior (tolerate within factor, OOM beyond, recover via BLESS CLEAR) is parameterized across all nine evicting maxmemory-policy values, with TTLs on keys when using volatile-*. New cases assert no overshoot tolerance when nothing blessed is an eviction candidate (noeviction, and volatile-lru with blessed keys that have no TTL).

TTL protection and pool-branch eviction floods add volatile-lfu, volatile-lrm, and allkeys-lrm; existing single-policy tests are mostly folded into foreach loops with policy names in test titles.

Reviewed by Cursor Bugbot for commit c3654b2. Bugbot is set up for automated code reviews on this repo. Configure here.

Cover the policies and eviction paths that tests/unit/bless.tcl did not
exercise yet:

- Protection under volatile-lfu, volatile-lrm and allkeys-lrm (added to the
  existing per-policy loops).
- The all-blessed bounded overshoot (tolerated within 1.25x maxmemory, OOM
  past it, BLESS CLEAR relieves it) under all nine evicting policies instead
  of allkeys-random only. Keys get a TTL under volatile-*.
- Time-sliced eviction: lazyfree-lazy-eviction yes with
  maxmemory-eviction-tenacity 0.
- No overshoot when no blessed key is an eviction candidate (noeviction, and
  volatile-lru with blessed keys that have no TTL): the plain maxmemory limit
  applies.

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

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@LiranAbir
LiranAbir marked this pull request as ready for review October 18, 2026 11:56
@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.23%. Comparing base (e0bb931) to head (c3654b2).
⚠️ Report is 4 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable   #15996      +/-   ##
============================================
+ Coverage     78.15%   78.23%   +0.07%     
============================================
  Files           155      155              
  Lines         90139    90178      +39     
============================================
+ Hits          70448    70548     +100     
+ Misses        19691    19630      -61     

see 23 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gabsow
gabsow self-requested a review October 19, 2026 06:12

@gabsow gabsow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the test changes and found no blocking issues. The added cases cover the nine eviction policies, lazy eviction, and the no-candidate OOM behavior; the TTL setup for volatile-* cases and Tcl argument expansion look correct. I did not run the suite locally; the PR reports unit/bless passed on macOS arm64.

Comment thread tests/unit/bless.tcl Resolved
Per review: put the new foreach wrappers at column 0 instead of
re-indenting the wrapped tests, so the diff only shows the actual changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@LiranAbir
LiranAbir requested a review from sundb October 19, 2026 09:13

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit f3a14b3. Configure here.

Comment thread tests/unit/bless.tcl Resolved
@LiranAbir
LiranAbir requested a review from gabsow October 19, 2026 09:28
evicted_keys is a stat and FLUSHALL doesn't reset it, so in the foreach
loops a later case could pass `evicted_keys > 0` on evictions from an
earlier one. Run CONFIG RESETSTAT at the start of each case, as the
LRU-pool test already does.

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

gabsow commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

@sundb WDYT now ?

@gabsow
gabsow merged commit 194a599 into redis:unstable Oct 22, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants