Skip to content

Support RDB v14 - Support XNACK (part 1)#98

Merged
moticless merged 3 commits into
redis:mainfrom
moticless:support-v14-xnack
May 31, 2026
Merged

Support RDB v14 - Support XNACK (part 1)#98
moticless merged 3 commits into
redis:mainfrom
moticless:support-v14-xnack

Conversation

@moticless
Copy link
Copy Markdown
Collaborator

@moticless moticless commented May 19, 2026

Add support for parsing RDB v14 - XNACK (RDB_TYPE_STREAM_LISTPACKS_5.)

Core Parser:

  • Added RDB_TYPE_STREAM_LISTPACKS_5 (27) opcode for v14 streams
  • Added placeholder for RDB_TYPE_ARRAY (28) - will error cleanly
  • Parse per-consumer-group NACK zone (count + stream IDs)
  • Added handleStreamNackZoneEntry callback to public API

Handlers:

  • JSON: Emit NACKed IDs as "nacked": ["id1", "id2", ...] array
  • RESP: Batch NACKed entries into XNACK FAIL IDS ... RETRYCOUNT
    • Mirrors AOF rewrite behavior (64 IDs per batch)
    • Silently dropped on targets < 8.8 (XNACK landed in 8.8)
    • Batches consecutive IDs with same delivery_count
  • Filter: Pass through NACK zone entries

Version Support:

  • Added Redis 8.8 → RDB v14 mapping in src/redisver.h

Notes

  • NACK zone metadata is informational; streams still replay correctly via XADD/XGROUP/XCLAIM on older targets
  • RDB_TYPE_ARRAY placeholder added but not implemented (future work)

Note

Medium Risk
Updates core stream parsing and RESP/JSON emitters to handle new v14 encodings, which could affect correctness of stream replay and raw RESTORE payloads. Risk is mitigated by new fixtures and unit/integration tests covering both downgrade behavior and 8.8+ XNACK output.

Overview
Adds RDB v14 stream support for RDB_TYPE_STREAM_LISTPACKS_5 by parsing the per-consumer-group NACK zone and surfacing it via a new public callback handleStreamNackZoneEntry.

Extends the JSON and RESP exporters to consume this callback: JSON now emits a per-group "nacked" array of entry IDs, while RESP generation batches NACKed IDs into XNACK ... FAIL IDS ... RETRYCOUNT ... FORCE for Redis targets >= 8.8 (and drops NACK metadata for older targets). Also adds a clean error placeholder for the new v14 RDB_TYPE_ARRAY encoding.

Updates version mapping (Redis 8.8 -> RDB v14), adjusts CI Redis build flags to avoid clang+LTO failures on Ubuntu, and adds/updates fixtures and tests to cover v14 parsing, RESP output for targets 8.6 vs 8.8, and the new unsupported-type error path.

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

Copy link
Copy Markdown

@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 2 potential issues.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 0e0aef8. Configure here.

Comment thread src/ext/handlersToResp.c Outdated
Comment thread src/ext/handlersToResp.c Outdated
@moticless moticless force-pushed the support-v14-xnack branch 4 times, most recently from d73b252 to eebe93b Compare May 20, 2026 07:48
@moticless moticless force-pushed the support-v14-xnack branch from eebe93b to 742062e Compare May 20, 2026 10:05
Comment thread src/ext/handlersToResp.c
Comment thread src/ext/handlersToResp.c Outdated
Comment thread src/ext/handlersToJson.c
Comment thread src/ext/handlersToJson.c Outdated
Comment thread src/ext/handlersToResp.c
moticless and others added 2 commits May 24, 2026 11:42
…t entry

Surfaces the parser's remaining-count to the NACK-zone callback so the
RESP handler can flush the in-progress XNACK batch exactly when the
zone ends, instead of relying on flushes in toRespEndKey,
toRespStreamNewCGroup and toRespStreamIdmpMeta. Removes those three
cross-callback flush sites.

Fixes the symptom where XCFGSET could be emitted between XNACK commands
of the same CG (XCFGSET landed between the dc=0 and dc=1 batches when
the last NACK batch hadn't reached AOF_REWRITE_ITEMS_PER_CMD). The
final command order now matches Redis's AOF rewrite emission at
redis2/src/aof.c:2387-2442 (XNACK ... then XCFGSET).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@moticless moticless merged commit 83e01a1 into redis:main May 31, 2026
13 checks passed
@moticless moticless deleted the support-v14-xnack branch May 31, 2026 06:02
moticless added a commit that referenced this pull request Jun 3, 2026
Add support for the second Redis 8.8 RDB v14 type, RDB_TYPE_ARRAY
(opcode 28), following the Stream XNACK work merged in #98.

This change adds ABI-compatible public APIs for array metadata and
element callbacks, an insert-index sentinel, and an invalid-state error.

It also adds built-in array emission for JSON, RESP, and Print handlers.
JSON preserves uint64 fidelity by stringifying indexes. RESP emits ARMSET
batches and ARSEEK when a persisted non-default insert cursor exists, or
uses RESTORE when supported by the target.
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.

3 participants