Skip to content

MOD-19328: self-contained saves on cores without persistence flags - #1688

Merged
AvivDavid23 merged 1 commit into
masterfrom
MOD-19328-unflagged-self-contained
Nov 3, 2026
Merged

AvivDavid23 merged 1 commit into
masterfrom
MOD-19328-unflagged-self-contained

Conversation

@AvivDavid23

@AvivDavid23 AvivDavid23 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What

Follow-up to #1682, from review of RedisJSON/RedisJsonHdt#555.

A core that predates REDISMODULE_PERSISTENCE_FLAG_SYNCER and REDISMODULE_PERSISTENCE_FLAG_STDRDB passes no persistence info, so the module cannot tell that a save feeds a syncer or a backup. Both are restored one key at a time and refuse stream records.

  • rdb_persistence::require_persistence_flags(), called from an embedding build's init, makes every value of a save without persistence info self-contained. The start-of-save log line reports mode=local reason=no_flags.
  • A core with the flags passes the info on every save start, so its ordinary saves still stream.
  • OSS does not call it: a save without persistence info streams, as before.
  • The HDT build (Enterprise) calls it, so an Enterprise core older than RED-221962 never writes stream records.
  • The guide's "Readers that take one key at a time" list and its log table describe no_flags.

Testing

  • cargo test -p redis_json --lib: 120 tests, 121 with --features as-library.
  • New unit test a_save_without_persistence_info_never_streams_when_the_flags_are_required: with the call, a save without info writes self-contained records; a save with info and no flags still streams.
  • HDT builds against this branch with the call in its init.

🤖 Generated with Claude Code


Note

Medium Risk
Changes when RDB stream vs self-contained encoding is chosen for Enterprise on legacy cores, which affects backup/replica-of compatibility but is intentional and scoped to an explicit init call.

Overview
Adds rdb_persistence::require_persistence_flags(), an init-time opt-in for embedding builds (e.g. Enterprise) so saves on cores that pass no RedisModulePersistenceInfo never open a cross-key stream session. Those saves write self-contained values instead, because the module cannot tell backup/syncer saves from ordinary BGSAVE on older cores.

cross_key_stream_allowed now takes an unflagged branch: true when persistence data is null and the flag was set at init. OSS behavior is unchanged if the call is omitted (null data still streams). Saves on cores that do pass persistence info (even with zero flags) still stream as before.

Persistence start logging gains mode=local reason=no_flags. The RDB dictionary guide documents the new reason and the Enterprise require_persistence_flags() path.

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

A core that predates REDISMODULE_PERSISTENCE_FLAG_SYNCER and
REDISMODULE_PERSISTENCE_FLAG_STDRDB passes no persistence info, so the
module cannot tell that a save feeds a syncer or a backup, both restored
one key at a time. require_persistence_flags(), called from an embedding
build's init, makes every value of such a save self-contained
(reason=no_flags). Flagged cores still stream ordinary saves; OSS does
not call it and is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@AvivDavid23
AvivDavid23 merged commit 4666688 into master Nov 3, 2026
59 checks passed
@AvivDavid23
AvivDavid23 deleted the MOD-19328-unflagged-self-contained branch November 3, 2026 12:18
@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 62.50000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.69%. Comparing base (9ec5f3f) to head (a52aa55).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
redis_json/src/rdb_persistence.rs 62.50% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1688      +/-   ##
==========================================
- Coverage   87.74%   87.69%   -0.05%     
==========================================
  Files          18       18              
  Lines        6666     6673       +7     
==========================================
+ Hits         5849     5852       +3     
- Misses        817      821       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

1 participant