-
Notifications
You must be signed in to change notification settings - Fork 24.5k
Closed
Description
Describe the bug
Blocking reads on Redis Cluster replica nodes (in readonly mode) always get redirected to a master node.
To reproduce
Connect to a replica node, go into a readonly mode, do a blocking read, e.g.:
127.0.0.1:6381> CONNECT 127.0.0.1 6385
127.0.0.1:6385> READONLY
OK
127.0.0.1:6385> XREAD STREAMS k 0
(nil)
127.0.0.1:6385> XREAD BLOCK 100 STREAMS k 0
-> Redirected to slot [7629] located at 127.0.0.1:6381
(nil)
127.0.0.1:6381>
Expected behavior
According to documentation of READONLY:
When the connection is in readonly mode, the cluster will send a redirection to the client only if the operation involves keys not served by the replica's master node.
blocking reads should not get redirected to a master node.
Additional information
IIUC the clusterRedirectBlockedClientIfNeeded does not handle the case when the blocking read is on a replica node:
Lines 5856 to 5862 in 3945a32
| clusterNode *node = server.cluster->slots[slot]; | |
| /* We send an error and unblock the client if: | |
| * 1) The slot is unassigned, emitting a cluster down error. | |
| * 2) The slot is not handled by this node, nor being imported. */ | |
| if (node != myself && | |
| server.cluster->importing_slots_from[slot] == NULL) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels