Merged
Conversation
add count_keys_in_slot and get_keys_in_slot methods to keyspace for cluster slot inspection. add corresponding shard request/response variants and dispatch handlers. these support the CLUSTER COUNTKEYSINSLOT and CLUSTER GETKEYSINSLOT commands.
add MigrationManager to ClusterCoordinator and implement the four SETSLOT subcommands: IMPORTING, MIGRATING, NODE, and STABLE. validates slot ranges, node IDs, and ownership before starting migrations.
replace "not yet implemented" stubs with real dispatch: - SETSLOT IMPORTING/MIGRATING/NODE/STABLE → cluster coordinator - COUNTKEYSINSLOT → broadcast to shards, sum counts - GETKEYSINSLOT → broadcast to shards, aggregate and truncate - REPLICATE/FAILOVER → honest "not yet supported" error - MIGRATE → kept as not implemented (needs remote connections)
covers importing, migrating, node, and stable subcommands including edge cases: invalid slot, self-import/migrate rejection, duplicate migration, non-owner migration, node assignment, migration cleanup, and stable noop.
kacy
added a commit
that referenced
this pull request
Feb 11, 2026
* feat: add slot-aware key queries to keyspace and shard add count_keys_in_slot and get_keys_in_slot methods to keyspace for cluster slot inspection. add corresponding shard request/response variants and dispatch handlers. these support the CLUSTER COUNTKEYSINSLOT and CLUSTER GETKEYSINSLOT commands. * feat: add SETSLOT command handlers to cluster coordinator add MigrationManager to ClusterCoordinator and implement the four SETSLOT subcommands: IMPORTING, MIGRATING, NODE, and STABLE. validates slot ranges, node IDs, and ownership before starting migrations. * feat: wire remaining cluster commands in connection handler replace "not yet implemented" stubs with real dispatch: - SETSLOT IMPORTING/MIGRATING/NODE/STABLE → cluster coordinator - COUNTKEYSINSLOT → broadcast to shards, sum counts - GETKEYSINSLOT → broadcast to shards, aggregate and truncate - REPLICATE/FAILOVER → honest "not yet supported" error - MIGRATE → kept as not implemented (needs remote connections) * test: add unit tests for SETSLOT command handlers covers importing, migrating, node, and stable subcommands including edge cases: invalid slot, self-import/migrate rejection, duplicate migration, non-owner migration, node assignment, migration cleanup, and stable noop.
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.
summary
wires 7 of the 9 "not yet implemented" cluster commands in
connection.rs:ClusterCoordinatormethods backed byMigrationManagerfrom ember-clusteradds
count_keys_in_slot()andget_keys_in_slot()to keyspace with corresponding shard request/response variants.what was tested
cargo clippy --workspace -- -D warningscleandesign considerations
MigrationManageradded toClusterCoordinatorbehind aMutexsince migration state changes are infrequentember-clusteradded as a dependency ofemberkv-corefor thekey_slotfunction