Skip to content

Commit 6bb61d1

Browse files
murphyjacob4madolson
authored andcommitted
Stop using DEBUG LOADAOF on replica in ASM tests (#2719)
DEBUG LOADAOF sometimes works but it results in -LOADING responses to the primary so there are lots of race conditions. It isn't something we should be doing anyways. To test, I just disconnect the replica before loading the AOF, then reconnect it. Fixes #2712 Signed-off-by: Jacob Murphy <[email protected]> (cherry picked from commit dbcf022) Signed-off-by: cherukum-amazon <[email protected]>
1 parent 626b365 commit 6bb61d1

File tree

1 file changed

+26
-10
lines changed

1 file changed

+26
-10
lines changed

tests/unit/cluster/cluster-migrateslots.tcl

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,11 +2183,21 @@ start_cluster 3 3 {tags {logreqres:skip external:skip cluster aofrw} overrides {
21832183
# Make sure the replicas have it
21842184
wait_for_countkeysinslot 3 16383 500
21852185

2186-
# First, reload the AOF, without restart. It should still keep the
2187-
# migration state.
2186+
# Disconnect the replica and load the AOF, it should still be in there
2187+
# but should fail and cleanup on load.
2188+
assert_match "OK" [R 3 CLUSTER REPLICATE NO ONE]
21882189
assert_match "OK" [R 3 DEBUG LOADAOF]
2189-
wait_for_migration_field 3 $jobname state occurring-on-primary
2190+
wait_for_migration_field 3 $jobname state failed
21902191
assert_match "0" [R 3 DBSIZE]
2192+
assert_match "0" [R 3 CLUSTER COUNTKEYSINSLOT 16383]
2193+
2194+
# Reconnect the replica and wait for AOF rewrite
2195+
assert_match "OK" [R 3 CLUSTER REPLICATE $node0_id]
2196+
wait_for_sync [srv -3 client] 50 1000
2197+
assert_match "occurring-on-primary" [dict get [get_migration_by_name 3 $jobname] state]
2198+
assert_match "0" [R 3 DBSIZE]
2199+
assert_match "500" [R 3 CLUSTER COUNTKEYSINSLOT 16383]
2200+
waitForBgrewriteaof [srv -3 client]
21912201

21922202
# Restart the replica and wait for resync
21932203
do_node_restart 3
@@ -2197,22 +2207,30 @@ start_cluster 3 3 {tags {logreqres:skip external:skip cluster aofrw} overrides {
21972207
# persist the replication ID, this is because of a full resync.
21982208
wait_for_migration_field 3 $jobname state occurring-on-primary
21992209
assert_match "0" [R 3 DBSIZE]
2210+
assert_match "500" [R 3 CLUSTER COUNTKEYSINSLOT 16383]
22002211

2201-
# Fail the migration and reload the AOF. We should have no migrations on
2202-
# the replica
2212+
# Fail the migration and wait for AOF rewrite
22032213
assert_match "OK" [R 2 CLUSTER CANCELSLOTMIGRATIONS]
22042214
wait_for_migration_field 3 $jobname state failed
22052215
assert_match "0" [R 3 DBSIZE]
22062216
assert_match "0" [R 3 CLUSTER COUNTKEYSINSLOT 16383]
2207-
2208-
# Load the AOF, it should still be in there. First ensure the AOF is
2209-
# done being rewritten with the latest full sync.
22102217
waitForBgrewriteaof [srv -3 client]
2218+
2219+
# Disconnect the replica and load the AOF, it should still be in there
2220+
# but in failed state.
2221+
assert_match "OK" [R 3 CLUSTER REPLICATE NO ONE]
22112222
assert_match "OK" [R 3 DEBUG LOADAOF]
22122223
assert_match "failed" [dict get [get_migration_by_name 3 $jobname] state]
22132224
assert_match "0" [R 3 DBSIZE]
22142225
assert_match "0" [R 3 CLUSTER COUNTKEYSINSLOT 16383]
22152226

2227+
# Reconnect the replica and wait for AOF rewrite
2228+
assert_match "OK" [R 3 CLUSTER REPLICATE $node0_id]
2229+
wait_for_sync [srv -3 client] 50 1000
2230+
assert_match "0" [R 3 DBSIZE]
2231+
assert_match "0" [R 3 CLUSTER COUNTKEYSINSLOT 16383]
2232+
waitForBgrewriteaof [srv -3 client]
2233+
22162234
# Cleanup
22172235
set_debug_prevent_pause 0
22182236
assert_match "OK" [R 2 FLUSHALL SYNC]
@@ -2288,9 +2306,7 @@ start_cluster 3 3 {tags {logreqres:skip external:skip cluster aofrw} overrides {
22882306
assert_match "0" [R 0 CLUSTER COUNTKEYSINSLOT 16383]
22892307
R 2 DEBUG LOADAOF
22902308
assert_match "500" [R 2 CLUSTER COUNTKEYSINSLOT 16383]
2291-
R 3 DEBUG LOADAOF
22922309
assert_match "0" [R 3 CLUSTER COUNTKEYSINSLOT 16383]
2293-
R 5 DEBUG LOADAOF
22942310
assert_match "500" [R 5 CLUSTER COUNTKEYSINSLOT 16383]
22952311
assert_equal $slots_start [R 0 CLUSTER SLOTS]
22962312
assert_match "OK" [R 2 FLUSHDB SYNC]

0 commit comments

Comments
 (0)