Skip to content

Handle Valkey 9 RDB_OPCODE_SLOT_IMPORT - #120

Open
otheng03 wants to merge 2 commits into
leonchen83:masterfrom
otheng03:valkey-slot-import
Open

otheng03 wants to merge 2 commits into
leonchen83:masterfrom
otheng03:valkey-slot-import

Conversation

@otheng03

Copy link
Copy Markdown
Contributor

Summary

A Valkey 9 cluster primary that is importing a slot (atomic slot migration) writes RDB_OPCODE_SLOT_IMPORT (243) into its RDB. A full sync from that primary currently fails with unexpected value type:243.

Changes

  • RdbParser: handle opcode 243 as applySlotImport, but only under Flavor.VALKEY.

How it was tested

  • SlotImportTest: parses dump-slot-import.rdb, a real RDB saved by Valkey 9.0.3 mid-import, with the default and skip visitors. It also checks that 243 is still rejected for the Redis flavor.
  • SlotMigrationTest: runs a full sync against a real 2-node Valkey cluster while the import is held open. Then it cancels the migration and checks that the imported key's deletion arrives in the replication stream.
  • New CI job valkey-cluster in docker-tests.yml. Locally you can run the same thing with:
.github/scripts/valkey-cluster.sh test

The first commit adds only the tests, so you can see them fail before the fix.

A Valkey 9 cluster primary that is importing a slot (atomic slot
migration) writes RDB_OPCODE_SLOT_IMPORT (243) into its RDB. A full sync
from such a primary fails with "unexpected value type:243".

* SlotImportTest parses dump-slot-import.rdb, an RDB saved by Valkey
  9.0.3 in the middle of a slot import, with the default and skip
  visitors.
* SlotMigrationTest runs a full sync against a real 2-node cluster with
  the import held open, then cancels the migration and expects the
  imported key's deletion in the replication stream.
* valkey-cluster.sh starts the cluster for local runs and CI
  (`.github/scripts/valkey-cluster.sh test`), and docker-tests.yml gets a
  valkey-cluster job that runs it.

Both tests fail until the opcode is handled.
Parse RDB_OPCODE_SLOT_IMPORT (243) so a full sync from a Valkey 9
cluster primary in the middle of an atomic slot migration no longer
fails with "unexpected value type:243".

The slot import state is server-internal, so DefaultRdbVisitor skips it
with SkipRdbParser and emits no event. SkipRdbVisitor inherits it.

Redis 8.6+ writes 243 as RDB_OPCODE_KEY_META with a different layout,
so the opcode is handled only under Flavor.VALKEY. For Redis it still
falls through to the existing error.
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