diff options
author | Viktor Söderqvist <viktor.soderqvist@est.tech> | 2022-04-02 23:58:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-02 14:58:07 -0700 |
commit | b53c7f2c0bb8692fd30c59348190c2bd897958a0 (patch) | |
tree | 4e109e875b1ee04b8c397a4810881d1ff9be232e /tests/cluster | |
parent | b8eb2a73408fa3b8845760857dd6fcccb62107fe (diff) | |
download | redis-b53c7f2c0bb8692fd30c59348190c2bd897958a0.tar.gz |
Turn into replica on SETSLOT (#10489)
* Fix race condition where node loses its last slot and turns into replica
When a node has lost its last slot and finds out from the SETSLOT command
before the cluster bus PONG from the new owner arrives. In this case, the
node didn't turn itself into a replica of the new slot owner.
This commit adds the same logic to the SETSLOT command as already exists
for the cluster bus PONG processing.
* Revert "Fix new / failing cluster slot migration test (#10482)"
This reverts commit 0b21ef8d49c47a5dd47a0bcc0cf1b2c235f24fd0.
In this test, the old slot owner finds out that it has lost its last
slot in a nondeterministic way. Either the cluster bus PONG from the
new slot owner and sometimes in a SETSLOT command from redis-cli. In
both cases, the result should be the same and the old owner should
turn itself into a replica of the new slot owner.
Diffstat (limited to 'tests/cluster')
-rw-r--r-- | tests/cluster/tests/12-replica-migration-2.tcl | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/cluster/tests/12-replica-migration-2.tcl b/tests/cluster/tests/12-replica-migration-2.tcl index f0493e57e..ed680061c 100644 --- a/tests/cluster/tests/12-replica-migration-2.tcl +++ b/tests/cluster/tests/12-replica-migration-2.tcl @@ -45,11 +45,12 @@ test "Resharding all the master #0 slots away from it" { } -test "Master #0 should lose its replicas" { +test "Master #0 who lost all slots should turn into a replica without replicas" { wait_for_condition 1000 50 { - [llength [lindex [R 0 role] 2]] == 0 + [RI 0 role] == "slave" && [RI 0 connected_slaves] == 0 } else { - fail "Master #0 still has replicas" + puts [R 0 info replication] + fail "Master #0 didn't turn itself into a replica" } } |