Skip to content

Support RDB v13#93

Merged
moticless merged 5 commits intoredis:mainfrom
moticless:main-supporting-rdb-v13
Mar 1, 2026
Merged

Support RDB v13#93
moticless merged 5 commits intoredis:mainfrom
moticless:main-supporting-rdb-v13

Conversation

@moticless
Copy link
Collaborator

@moticless moticless commented Feb 25, 2026

Add parsing support for RDB Version 13 (Redis 8.6). This includes:

Stream IDMP (Idempotent Message Producer) support:

  • New encoded type RDB_TYPE_STREAM_LISTPACKS_4 for streams with IDMP data
  • Parse IDMP metadata: duration, max entries, producers, and IID mappings
  • New callbacks: handleStreamIdmpMeta, handleStreamIdmpProducer,
    handleStreamIdmpEntry
  • RESP output generates XCFGSET and XIDMPRECORD commands for Redis 8.6+
  • JSON output includes full IDMP structure when includeStreamMeta enabled

Key Metadata support:

  • New opcode RDB_OPCODE_KEY_META (243) for module metadata classes
  • Track numMeta count in RdbKeyInfo structure
  • Add %m format specifier for print handler
  • Serialize key metadata on RESTORE (L0). Otherwise discard it since
    metadata cannot be reconstructed without RESTORE command.

Testing:

  • Stream v13: JSON output, RESP output (target 8.4 and 8.6), Redis reconstruct
    in both RESTORE (L0) and non-RESTORE (L1/L2) modes
  • Key metadata: both RESTORE and non-RESTORE modes; verifies metadata
    preserved only via RESTORE
  • Requires test_keymeta module for key metadata tests (auto-skipped if absent)

Note

High Risk
Touches the core RDB parsing state machine and RESP/JSON emitters to handle new v13 opcodes/types, which could regress parsing or serialization for existing dumps if edge cases are missed.

Overview
Adds RDB v13 (Redis 8.6) support by introducing the new stream encoding RDB_TYPE_STREAM_LISTPACKS_4 and parsing/propagating Stream IDMP (producer config + iid→stream-id mappings) via new data callbacks (handleStreamIdmpMeta/handleStreamIdmpProducer/handleStreamIdmpEntry). JSON output can now optionally include IDMP data (includeStreamIdmp), and RESP generation emits XCFGSET/XIDMPRECORD when targeting Redis 8.6+ (otherwise omits IDMP commands).

Adds parsing for the new key-metadata opcode RDB_OPCODE_KEY_META (243), tracks the per-key metadata class count (RdbKeyInfo.numMeta), preserves metadata only in raw/RESTORE mode (discarded at struct/data levels), and exposes it in print formatting via %m. Updates CLI/README help text and expands tests/fixtures for v13 streams, target-version RESP output, and key-metadata round-trips (auto-skipping when the test_keymeta module isn’t available).

Written by Cursor Bugbot for commit 17c22c8. This will update automatically on new commits. Configure here.

@tezc
Copy link
Collaborator

tezc commented Feb 25, 2026

I glanced over the PR but couldn't do a meaningful review yet. Tomorrow, I'll give it another go after taking a look at stream PR first but I doubt I'll be able to provide a meaningful review. Btw, if we can turn on Cursor in the repo, it will be more useful than me.

Copy link

@cursor cursor bot left a comment

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 and found 1 potential issue.

oranagra
oranagra previously approved these changes Mar 1, 2026
Copy link
Member

@oranagra oranagra left a comment

Choose a reason for hiding this comment

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

approving based on previous reviews

The call to newRawKey(p) in elementNewKey() was discarding the returned
RdbStatus. This function can fail when aggMakeRoom() or aggUpdateWritten()
encounter errors (e.g., when maxRawSize is exceeded). Without proper error
checking, these failures were silently swallowed, potentially leading to
corrupted raw aggregator state and invalid RESTORE output.

Wrapped the call with IF_NOT_OK_RETURN() to properly propagate errors up
the call chain, consistent with error handling patterns throughout the
codebase.
@moticless moticless merged commit 4231139 into redis:main Mar 1, 2026
13 checks passed
@moticless moticless deleted the main-supporting-rdb-v13 branch March 1, 2026 13:04
@moticless moticless mentioned this pull request Mar 1, 2026
moticless added a commit that referenced this pull request Mar 1, 2026
### New Features
- **RDB v13 Support**: Add support for RDB version 13 (#93)
  - Ensures compatibility with latest Redis RDB format, specifically key-metadata and stream IDMP
- **RESTOREMODAUX Downgrading**: Support downgrading RESTOREMODAUX commands (#92)
  - Enables compatibility when restoring to older Redis versions
- **Redis Enterprise Support**: Skip new Redis Enterprise RDB_OPCODE_SLOT_NUM opcode (#91)
  - Improves compatibility with Redis Enterprise RDB files
- **Authentication**: Add LIBRDB_AUTH environment variable support for password authentication
  - Simplifies authentication configuration in automated environments

### Bug Fixes
- **Error Handling**: Add goto cleanup on rdb-cli return error
  - Ensures proper resource cleanup on error conditions
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