2021-07-30 15:00:07 +08:00
|
|
|
# Tests for many simultaneous migrations.
|
2021-03-29 13:52:02 +03:00
|
|
|
|
2024-05-09 10:14:47 +08:00
|
|
|
source tests/support/cluster_util.tcl
|
2021-03-29 13:52:02 +03:00
|
|
|
|
2021-04-06 11:57:57 +03:00
|
|
|
# TODO: This test currently runs without replicas, as failovers (which may
|
|
|
|
# happen on lower-end CI platforms) are still not handled properly by the
|
|
|
|
# cluster during slot migration (related to #6339).
|
|
|
|
|
2024-05-09 10:14:47 +08:00
|
|
|
start_cluster 10 0 {tags {external:skip cluster}} {
|
2021-04-13 00:00:57 +03:00
|
|
|
config_set_all_nodes cluster-allow-replica-migration no
|
2021-03-29 13:52:02 +03:00
|
|
|
|
|
|
|
test "Cluster is up" {
|
2024-05-09 10:14:47 +08:00
|
|
|
wait_for_cluster_state ok
|
2021-03-29 13:52:02 +03:00
|
|
|
}
|
|
|
|
|
2024-05-09 10:14:47 +08:00
|
|
|
set cluster [valkey_cluster 127.0.0.1:[srv 0 port]]
|
2021-03-29 13:52:02 +03:00
|
|
|
catch {unset nodefrom}
|
|
|
|
catch {unset nodeto}
|
|
|
|
|
|
|
|
$cluster refresh_nodes_map
|
|
|
|
|
|
|
|
test "Set many keys" {
|
|
|
|
for {set i 0} {$i < 40000} {incr i} {
|
|
|
|
$cluster set key:$i val:$i
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test "Keys are accessible" {
|
|
|
|
for {set i 0} {$i < 40000} {incr i} {
|
|
|
|
assert { [$cluster get key:$i] eq "val:$i" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test "Init migration of many slots" {
|
|
|
|
for {set slot 0} {$slot < 1000} {incr slot} {
|
|
|
|
array set nodefrom [$cluster masternode_for_slot $slot]
|
|
|
|
array set nodeto [$cluster masternode_notfor_slot $slot]
|
|
|
|
|
|
|
|
$nodefrom(link) cluster setslot $slot migrating $nodeto(id)
|
|
|
|
$nodeto(link) cluster setslot $slot importing $nodefrom(id)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
test "Fix cluster" {
|
2021-04-06 11:57:57 +03:00
|
|
|
wait_for_cluster_propagation
|
2021-03-29 13:52:02 +03:00
|
|
|
fix_cluster $nodefrom(addr)
|
|
|
|
}
|
|
|
|
|
|
|
|
test "Keys are accessible" {
|
|
|
|
for {set i 0} {$i < 40000} {incr i} {
|
|
|
|
assert { [$cluster get key:$i] eq "val:$i" }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-13 00:00:57 +03:00
|
|
|
config_set_all_nodes cluster-allow-replica-migration yes
|
2024-05-09 10:14:47 +08:00
|
|
|
|
|
|
|
} ;# start_cluster
|