-
Notifications
You must be signed in to change notification settings - Fork 24.4k
Closed
Milestone
Description
The problem/use-case that the feature addresses
With the new CLUSTER SHARDS command and the documentation, SHARD is now a first class citizen in Redis cluster. However, unlike NODES or SLOTS, there is currently no unique ID associated with a SHARD.
A SHARD ID would allow an external entity to
- Directly reference a shard (no longer via the unwieldy slot ranges)
- Easily check whether two nodes belong to the same shard, even when one of them or both are down permanently. Today, a FAILED node would be listed under an "empty" shard in the
CLUSTER SHARDSoutput because there is no easy way to retain its relationship with the shard.
Description of the feature
- Introduce a 40-byte string as the shard ID, which is generated in the same way as the node ID
- Every node gets a new shard ID on its first startup and the ID gets persisted to the nodes.conf as the last field in the node record (or next to the hostname)
- On restart, the node gets its shard ID back from its nodes.conf
- The shard ID is broadcast to the cluster in the same way as the hostname via the gossip Ping extension
- On
CLUSTER REPLICATE, the replica node updates its shard ID to match its primary's CLUSTER SHARDSis updated to output the shard ID as well (as the first field and before the slot range)- [optional] Since
CLUSTER SLOTSis deprecated (in 7.0+), no change is expected - [optional] Ideally,
CLUSTER NODESshould be updated but then there is the backcompat risk so either we skip it or expose the shard ID under a new named config. - [optional] Introduce a new
CLUSTER MYSHARDID(less appcompat risk) or amendCLUSTER MYID(more natural but more appcompat risk) to return the node's shard ID. - [optional] Should
CLUSTER REPLICASbe amended as well?
Alternatives you've considered
Additional information
Metadata
Metadata
Assignees
Labels
No labels