Commit 99de3d3
KJ Tsanaktsidis
Don't attempt redirection on the actual MULTI for WATCH...MULTI
If we have a WATCH, then the MULTI _must_ exec on exactly that node; it
should not be allowed for that to be redirected to a different node,
because then the MULTI isn't on the same connection as the WATCH
anymore!
The first part of this patch fixes this by disabling redirection
handling in transaction.rb if we are in a watch. I also added a test
test_the_state_of_cluster_resharding_with_reexecuted_watch for this.
However, the second part of this patch is a lot trickier...
This change causes a different test,
test_the_state_of_cluster_resharding_with_transaction_and_watch, to
break. That test is asserting that
- if we watch something where the slot is in the middle of migrating
between nodes,
- and all the keys we wanted to watch are on the new node,
- that the client correctly retries the transaction with ASKING against
the new node
Disabling redirection handling obviously makes this stop working, and it
_is_ possible to handle this case correctly. We need to record whether
or not we had to issue an ASKING on the WATCH for the transaction, and
if so, pre-emptively issue an ASKING on the MULTI too. That's because
this slot is not yet actually assigned to the node we're connected to
(it's IMPORTING).
It may well not be worth it, and I'm also OK with just failing
WATCH/MULTI on slots which are currently migrating. That would imply:
- Keeping test_the_state_of_cluster_resharding_with_reexecuted_watch
- Deleting test_the_state_of_cluster_resharding_with_transaction_and_watch1 parent 9546682 commit 99de3d3
File tree
4 files changed
+64
-10
lines changed- lib/redis_client
- cluster
- test
4 files changed
+64
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
101 | | - | |
| 101 | + | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | 13 | | |
13 | 14 | | |
| |||
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
20 | | - | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
| 24 | + | |
23 | 25 | | |
24 | 26 | | |
25 | | - | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
40 | 61 | | |
41 | 62 | | |
42 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
96 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
97 | 102 | | |
98 | 103 | | |
99 | 104 | | |
| |||
110 | 115 | | |
111 | 116 | | |
112 | 117 | | |
113 | | - | |
| 118 | + | |
| 119 | + | |
114 | 120 | | |
115 | 121 | | |
116 | 122 | | |
| |||
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
142 | | - | |
| 148 | + | |
143 | 149 | | |
144 | 150 | | |
145 | 151 | | |
146 | | - | |
147 | 152 | | |
148 | 153 | | |
149 | 154 | | |
150 | | - | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
106 | 135 | | |
107 | 136 | | |
108 | 137 | | |
| |||
0 commit comments