summaryrefslogtreecommitdiff
path: root/tests/support
diff options
context:
space:
mode:
authorViktor Söderqvist <viktor.soderqvist@est.tech>2022-03-16 18:11:38 +0100
committerGitHub <noreply@github.com>2022-03-16 10:11:38 -0700
commit69017fa232093728a84dfcb1befe7bc4b204c182 (patch)
tree2f339ed5225d062565a8295dcaf17637e37d8bae /tests/support
parent61b7e5916dc9887f97e8c6f0c92af7509b29dbaf (diff)
downloadredis-69017fa232093728a84dfcb1befe7bc4b204c182.tar.gz
Fix redis-cli CLUSTER SETSLOT race conditions (#10381)
After migrating a slot, send CLUSTER SETSLOT NODE to the destination node first to make sure the slot isn't left without an owner in case the destination node crashes before it is set as new owner. When informing the source node, it can happen that the destination node has already informed it and if the source node has lost its last slot, it has already turned itself into a replica. Redis-cli should ignore this error in this case.
Diffstat (limited to 'tests/support')
-rw-r--r--tests/support/server.tcl8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/support/server.tcl b/tests/support/server.tcl
index b06bd73ba..9d0c4510d 100644
--- a/tests/support/server.tcl
+++ b/tests/support/server.tcl
@@ -684,6 +684,14 @@ proc start_server {options {code undefined}} {
}
}
+# Start multiple servers with the same options, run code, then stop them.
+proc start_multiple_servers {num options code} {
+ for {set i 0} {$i < $num} {incr i} {
+ set code [list start_server $options $code]
+ }
+ uplevel 1 $code
+}
+
proc restart_server {level wait_ready rotate_logs {reconnect 1} {shutdown sigterm}} {
set srv [lindex $::servers end+$level]
if {$shutdown ne {sigterm}} {