mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
Merge branch 'unstable' of github.com:/antirez/redis into unstable
This commit is contained in:
commit
0ca2f4f824
@ -637,3 +637,55 @@ start_server {tags {"repl"}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test {replicaof right after disconnection} {
|
||||||
|
# this is a rare race condition that was reproduced sporadically by the psync2 unit.
|
||||||
|
# see details in #7205
|
||||||
|
start_server {tags {"repl"}} {
|
||||||
|
set replica1 [srv 0 client]
|
||||||
|
set replica1_host [srv 0 host]
|
||||||
|
set replica1_port [srv 0 port]
|
||||||
|
set replica1_log [srv 0 stdout]
|
||||||
|
start_server {} {
|
||||||
|
set replica2 [srv 0 client]
|
||||||
|
set replica2_host [srv 0 host]
|
||||||
|
set replica2_port [srv 0 port]
|
||||||
|
set replica2_log [srv 0 stdout]
|
||||||
|
start_server {} {
|
||||||
|
set master [srv 0 client]
|
||||||
|
set master_host [srv 0 host]
|
||||||
|
set master_port [srv 0 port]
|
||||||
|
$replica1 replicaof $master_host $master_port
|
||||||
|
$replica2 replicaof $master_host $master_port
|
||||||
|
|
||||||
|
wait_for_condition 50 100 {
|
||||||
|
[string match {*master_link_status:up*} [$replica1 info replication]] &&
|
||||||
|
[string match {*master_link_status:up*} [$replica2 info replication]]
|
||||||
|
} else {
|
||||||
|
fail "Can't turn the instance into a replica"
|
||||||
|
}
|
||||||
|
|
||||||
|
set rd [redis_deferring_client -1]
|
||||||
|
$rd debug sleep 1
|
||||||
|
after 100
|
||||||
|
|
||||||
|
# when replica2 will wake up from the sleep it will find both disconnection
|
||||||
|
# from it's master and also a replicaof command at the same event loop
|
||||||
|
$master client kill type replica
|
||||||
|
$replica2 replicaof $replica1_host $replica1_port
|
||||||
|
$rd read
|
||||||
|
|
||||||
|
wait_for_condition 50 100 {
|
||||||
|
[string match {*master_link_status:up*} [$replica2 info replication]]
|
||||||
|
} else {
|
||||||
|
fail "role change failed."
|
||||||
|
}
|
||||||
|
|
||||||
|
# make sure psync succeeded, and there were no unexpected full syncs.
|
||||||
|
assert_equal [status $master sync_full] 2
|
||||||
|
assert_equal [status $replica1 sync_full] 0
|
||||||
|
assert_equal [status $replica2 sync_full] 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user