Commit ea24b5b
committed
Ensure command details are populated for Cluster clients
Previously, if a clustered client is unable to query any of the nodes
for command details during setup, it'd initialize successfully, but
without any command details. (This is a bit of a corner case - in order
to hit this case, at least one node needs to be reachable when querying
nodes + slots, but all nodes would need to be unreachable immediately
afterwards when querying command details.)
In this case, the client would be unable to determine which node a
given command should be routed to. Because the client falls back to
routing commands to a random node, and following redirects as
necessary, this wouldn't cause any overt problems, but leaves the client
following unnecessary redirects for the rest of the lifespan of the
client.
This patch changes the client to require that the initial fetch of
command details succeeds (as is already done with slot and node detail
fetching), and raises a CannotConnectError if that's not possible.
Users should already handle this error, and retry creating the client
later, or use some other suitable failure handling mechanism.1 parent 688ac95 commit ea24b5b
File tree
2 files changed
+19
-9
lines changed- lib/redis/cluster
- test
2 files changed
+19
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | 13 | | |
16 | | - | |
17 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
28 | | - | |
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | | - | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
88 | 99 | | |
0 commit comments