Skip to content

Commit 0949393

Browse files
satheeshaGowdaSatheesha Chattenahalli Hanume Gowdahpatromadolson
authored
Add shard id field to CLUSTER SHARDS response (#365)
Related to the PR valkey-io/valkey#2568 --------- Signed-off-by: Satheesha Chattenahalli Hanume Gowda <[email protected]> Signed-off-by: Harkrishn Patro <[email protected]> Co-authored-by: Satheesha Chattenahalli Hanume Gowda <[email protected]> Co-authored-by: Harkrishn Patro <[email protected]> Co-authored-by: Madelyn Olson <[email protected]>
1 parent c6af7b1 commit 0949393

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

commands/cluster-shards.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ A client should issue this command on startup in order to retrieve the map assoc
88
This map should be used to direct commands to the node that is likely serving the slot associated with a given command.
99
In the event the command is sent to the wrong node, in that it received a '-MOVED' redirect, this command can then be used to update the topology of the cluster.
1010

11-
The command returns an array of shards, with each shard containing two fields, 'slots' and 'nodes'.
11+
The command returns an array of shards, with each shard containing three fields, 'slots', 'nodes' and 'id'.
1212

1313
The 'slots' field is a list of slot ranges served by this shard, stored as pair of integers representing the inclusive start and end slots of the ranges.
1414
For example, if a node owns the slots 1, 2, 3, 5, 7, 8 and 9, the slots ranges would be stored as [1-3], [5-5], [7-9].
@@ -48,6 +48,8 @@ This can happen in a cluster that consists of only one node or the node has not
4848
The value `?` is displayed if the node is incorrectly configured to use announced hostnames but no hostname is configured using `cluster-announce-hostname`.
4949
Clients may treat the empty string in the same way as NULL, that is the same endpoint it used to send the current command to, while `"?"` should be treated as an unknown node, not necessarily the same node as the one serving the current command.
5050

51+
The 'id' field is the unique id of the shard, which is randomly generated and 40 characters long.
52+
5153
## Examples
5254

5355
```
@@ -84,6 +86,8 @@ Clients may treat the empty string in the same way as NULL, that is the same end
8486
12) (integer) 72156
8587
13) "health"
8688
14) "online"
89+
5) "id"
90+
6) "cd7688ca959bf54a32569ccf260b26715b82a6e3"
8791
2) 1) "slots"
8892
2) 1) (integer) 10923
8993
2) (integer) 16383
@@ -116,6 +120,8 @@ Clients may treat the empty string in the same way as NULL, that is the same end
116120
12) (integer) 72156
117121
13) "health"
118122
14) "online"
123+
5) "id"
124+
6) "0d77234c440a6b05c2d77d1b9f37ac63585fc747"
119125
3) 1) "slots"
120126
2) 1) (integer) 5461
121127
2) (integer) 10922
@@ -148,4 +154,6 @@ Clients may treat the empty string in the same way as NULL, that is the same end
148154
12) (integer) 72156
149155
13) "health"
150156
14) "online"
157+
5) "id"
158+
6) "a96f023185ea6d7f5e9a0d6ada6f112741217e6a"
151159
```

0 commit comments

Comments
 (0)