Skip to content

Commit 8528705

Browse files
enjoy-binbinvitarb
authored andcommitted
Add packet-drop to fix the new flaky failover test (#2196)
The new test was added in #2178, obviously there may be pending reads in the connection, so there may be a race in the DROP-CLUSTER-PACKET-FILTER part causing the test to fail. Add CLOSE-CLUSTER-LINK-ON-PACKET-DROP to ensure that the replica does not process the packet. Signed-off-by: Binbin <[email protected]> (cherry picked from commit 2019337)
1 parent 4030ad6 commit 8528705

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/blocked.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,12 @@ void unblockClient(client *c, int queue_for_reprocessing) {
230230
/* Check if the specified client can be safely timed out using
231231
* unblockClientOnTimeout(). */
232232
int blockedClientMayTimeout(client *c) {
233-
if (c->bstate->btype == BLOCKED_MODULE) {
233+
if (c->bstate.btype == BLOCKED_MODULE) {
234234
return moduleBlockedClientMayTimeout(c);
235235
}
236236

237-
if (c->bstate->btype == BLOCKED_LIST ||
238-
c->bstate->btype == BLOCKED_ZSET ||
239-
c->bstate->btype == BLOCKED_STREAM ||
240-
c->bstate->btype == BLOCKED_WAIT) {
237+
if (c->bstate.btype == BLOCKED_LIST || c->bstate.btype == BLOCKED_ZSET || c->bstate.btype == BLOCKED_STREAM ||
238+
c->bstate.btype == BLOCKED_WAIT) {
241239
return 1;
242240
}
243241
return 0;

tests/unit/cluster/failover2.tcl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ proc test_replica_config_epoch_failover {type} {
148148
R 3 CONFIG SET cluster-replica-no-failover yes
149149
}
150150
R 3 DEBUG DROP-CLUSTER-PACKET-FILTER $CLUSTER_PACKET_TYPE_ALL
151+
R 3 DEBUG CLOSE-CLUSTER-LINK-ON-PACKET-DROP 1
151152

152153
set R0_nodeid [R 0 cluster myid]
153154

@@ -170,6 +171,7 @@ proc test_replica_config_epoch_failover {type} {
170171
# Pause the R 0 and wait for the cluster to be down.
171172
pause_process [srv 0 pid]
172173
R 3 DEBUG DROP-CLUSTER-PACKET-FILTER $CLUSTER_PACKET_TYPE_NONE
174+
R 3 DEBUG CLOSE-CLUSTER-LINK-ON-PACKET-DROP 0
173175
wait_for_condition 1000 50 {
174176
[CI 1 cluster_state] == "fail" &&
175177
[CI 2 cluster_state] == "fail" &&

0 commit comments

Comments
 (0)