Repository navigation
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## MOD-20882-rdb-dictionary-cluster #1705 +/- ##
=================================================================
Coverage 87.74% 87.74%
=================================================================
Files 18 18
Lines 6723 6723
=================================================================
Hits 5899 5899
Misses 824 824 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit fba739c. Configure here.
test_short_read.py set Defaults.no_log = True when it was imported. RLTest imports every test file before a run, so every server in a full run logged to /dev/null, and every test that reads the server log skipped in CI: the three new cluster tests, and three tests of test_rdb_dictionary.py. testShortReadJson now builds its own Env with no_log set, and restores the default right after, so only its servers log nowhere. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A new tests/pytest/test_rdb_dictionary_budget.py checks json-rdb-dictionary-max-memory-percent on a real server, in the plain lane: - the budget is the configured share of used_memory at save start, a running BGSAVE keeps the setting it started with, and the next save takes a CONFIG SET made meanwhile; - a module argument of 150 counts as 100 and one of -5 turns sharing off, while CONFIG SET still refuses both; - a 1% table resets and still shares strings, a full table defines each string once, and every document reloads. On Linux with jemalloc, the fork child's copy-on-write memory shows the 1% table stays within its budget while a full table does not. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…abase Flex saves each value on its own (mode=local reason=flex), so it writes no stream for these tests to check. test_rdb_dictionary.py skips Flex the same way. The checks count every key the server holds, so the test env helper now runs FLUSHALL first, in case a run reuses a server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The developer confirmed that a json-rdb-dictionary-max-memory-percent module argument outside 0 to 100 should stop the module from loading, not be clamped (MOD-21358). Replace the two tests that asserted the clamp: - test_a_module_argument_that_does_not_parse_is_refused: a server started with 100 comes up, and one started with abc does not. - test_a_module_argument_outside_0_to_100_is_refused: servers started with -1 and 101 must not come up. It fails until MOD-21358 is fixed in redismodule-rs. The range check of CONFIG SET stays covered by test_rdb_dictionary.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
LiranAbir
force-pushed
the
MOD-20882-rdb-dictionary-budget
branch
from
November 18, 2026 13:07
fba739c to
b5ba16a
Compare
LiranAbir
changed the base branch from
MOD-20882-rdb-dictionary-cluster
to
master
November 18, 2026 13:07
This branch has not been deployed
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.

Based on
master, apart from #1699, so this PR can merge on its own and its failing test can be discussed separately (see MOD-21358 below).It also carries #1699's
test_short_read.pyfix (the first commit). Without it,test_short_read.pysends every server's log to/dev/nullin a full CI run, and the tests here that read the server log skip. The change is the same in both PRs, so whichever merges second keeps it as is.Why
json-rdb-dictionary-max-memory-percentcaps the string table of one RDB encoding v5 save (#1682). The budget formula, the clamping of module arguments and the table resets are unit-tested against a fake module API, andtest_rdb_dictionary.pycovers a tiny table's reset markers and the writer turned off. Nothing checked on a real server that the budget followsused_memory, that a setting change applies from the next save only, that an out-of-range module argument is refused, or that a full table stays within its budget in the fork child. This is §3.6 of the MOD-20882 OSS test plan.What
A new
tests/pytest/test_rdb_dictionary_budget.py, test-only. Every test runs on one plain server and skips in the--use-slaves,--use-aof,oss-clusterand existing-env lanes. The module's log lines are the oracle, and every test reloads and compares every document.test_a_config_change_applies_from_the_next_save: at 7%, a SAVE logsmode=stream percent=7withbudget_byteswithin 10% of 7% ofused_memory. A BGSAVE that starts at 7% (slowed withrdb-key-save-delay) keeps streaming whileCONFIG SETturns sharing off. Its RDB reloads as a stream, and the next SAVE logsmode=plain reason=off.test_a_module_argument_that_does_not_parse_is_refused: a server of its own started with the module argument100comes up (the control), and one started withabcdoes not.test_a_module_argument_outside_0_to_100_is_refused: servers started with-1and101must not come up. This test fails until MOD-21358 is fixed: redismodule-rs uses a module argument as the config's default without checking its range, so both load and each save clamps the value. The range check ofCONFIG SETis already covered bytest_rdb_dictionary.py.test_a_table_that_fills_resets_and_stays_within_its_budget: 200 documents in pairs that share 1,000 distinct strings per pair, plus 10 strings in every document.rdb_last_cow_sizeshows the table: against sharing off, the full table adds more than the 1% budget plus 1 MB, and the 1% table adds no more than that. macOS reports no copy-on-write, and valgrind and sanitizer builds use libc malloc, so the memory check runs only where it means something.The file imports only
common.TimeLimitand RLTest, and sets noDefaultsat module level.Findings:
reason=budgetfor a budget too small for any entry. The code logs it only when the budget comes out at 0 bytes, which a running server never does (1% ofused_memoryis tens of KB). A small table fills and resets instead, which is what the last test checks.150,-5) loads:CONFIG GETreports it as given, while saves use the clamped value. The developer confirmed it should be refused. Filed as MOD-21358; the range test above fails until it is fixed.abc) makes the module fail to load, so the server aborts. An out-of-range one should do the same.Testing
Run locally (macOS arm64) against Redis
unstable456b4b9a, with RedisJSON built from this branch. The mutant and Linux rows are from the first commit, run withtest_short_readloaded too, as in CI:test_a_module_argument_outside_0_to_100_is_refusedfails (MOD-21358)--use-slaves,--use-aof,--env oss-clustertest_a_table_that_fills_resets_and_stays_within_its_budgetfails (resets=0)test_a_config_change_applies_from_the_next_savefails (the next save still logspercent=7)redis:8.10.1, module built for Linux), the copy-on-write numbers of the last test, 5 rounds🤖 Generated with Claude Code
Note
Low Risk
Test-only changes with no production code; one new test is expected to fail until MOD-21358 lands.
Overview
Adds
test_rdb_dictionary_budget.py, end-to-end pytest coverage on a plain Redis server for RDB encoding v5’sjson-rdb-dictionary-max-memory-percentstring table budget. Tests drive SAVE/BGSAVE, parse moduleJSON RDB dictionarylog lines, andDEBUG RELOAD NOSAVEto verify documents round-trip.Coverage includes: 7% budget tied to
used_memory, config snapshotted for in-flight saves vs next-save behavior when sharing is turned off, module load refusal for non-numeric args (with a known-failing case for -1/101 until MOD-21358), and 1% budget exercising table resets while staying within budget (optional jemalloc COW checks on Linux).test_short_read.pystops settingDefaults.no_log = Trueglobally; onlytestShortReadJsontoggles it so other tests (including the new budget suite) can use server logs.Reviewed by Cursor Bugbot for commit b5ba16a. Bugbot is set up for automated code reviews on this repo. Configure here.