mirror of
https://github.com/fluencelabs/redis
synced 2025-04-25 10:32:14 +00:00
Regression test for PSYNC2 issue #3899 added.
Experimentally verified that it can trigger the issue reverting the fix. At least on my system... Being the bug time/backlog dependant, it is very hard to tell if this test will be able to trigger the problem consistently, however even if it triggers the problem once in a while, we'll see it in the CI environment at http://ci.redis.io.
This commit is contained in:
parent
b506eb74ac
commit
166bdbda03
61
tests/integration/psync2-reg.tcl
Normal file
61
tests/integration/psync2-reg.tcl
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
# Issue 3899 regression test.
|
||||||
|
# We create a chain of three instances: master -> slave -> slave2
|
||||||
|
# and continuously break the link while traffic is generated by
|
||||||
|
# redis-benchmark. At the end we check that the data is the same
|
||||||
|
# everywhere.
|
||||||
|
|
||||||
|
start_server {tags {"psync2"}} {
|
||||||
|
start_server {} {
|
||||||
|
start_server {} {
|
||||||
|
set start_time [clock seconds] ; # Test start time
|
||||||
|
|
||||||
|
# Config
|
||||||
|
set debug_msg 0 ; # Enable additional debug messages
|
||||||
|
|
||||||
|
set duration 20 ; # Total test seconds
|
||||||
|
|
||||||
|
for {set j 0} {$j < 3} {incr j} {
|
||||||
|
set R($j) [srv [expr 0-$j] client]
|
||||||
|
set R_host($j) [srv [expr 0-$j] host]
|
||||||
|
set R_port($j) [srv [expr 0-$j] port]
|
||||||
|
if {$debug_msg} {puts "Log file: [srv [expr 0-$j] stdout]"}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Setup the replication and backlog parameters
|
||||||
|
$R(1) slaveof $R_host(0) $R_port(0)
|
||||||
|
$R(2) slaveof $R_host(0) $R_port(0)
|
||||||
|
$R(0) set foo bar
|
||||||
|
wait_for_condition 50 1000 {
|
||||||
|
[$R(1) dbsize] == 1 && [$R(2) dbsize] == 1
|
||||||
|
} else {
|
||||||
|
fail "Slaves not replicating from master"
|
||||||
|
}
|
||||||
|
|
||||||
|
$R(0) config set repl-backlog-size 10mb
|
||||||
|
$R(1) config set repl-backlog-size 10mb
|
||||||
|
|
||||||
|
set cycle_start_time [clock milliseconds]
|
||||||
|
set bench_pid [exec src/redis-benchmark -p $R_port(0) -n 10000000 -r 1000 incr __rand_int__ > /dev/null &]
|
||||||
|
while 1 {
|
||||||
|
set elapsed [expr {[clock milliseconds]-$cycle_start_time}]
|
||||||
|
if {$elapsed > $duration*1000} break
|
||||||
|
if {rand() < .05} {
|
||||||
|
test "Kill first slave link with the master" {
|
||||||
|
$R(1) client kill type master
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if {rand() < .05} {
|
||||||
|
test "Kill chained slave link with the master" {
|
||||||
|
$R(2) client kill type master
|
||||||
|
}
|
||||||
|
}
|
||||||
|
after 100
|
||||||
|
}
|
||||||
|
|
||||||
|
wait_for_condition 50 1000 {
|
||||||
|
([$R(0) debug digest] eq [$R(1) debug digest]) &&
|
||||||
|
([$R(1) debug digest] eq [$R(2) debug digest])
|
||||||
|
} else {
|
||||||
|
fail "The three instances have different data sets"
|
||||||
|
}
|
||||||
|
}}}
|
@ -42,6 +42,7 @@ set ::all_tests {
|
|||||||
integration/convert-zipmap-hash-on-load
|
integration/convert-zipmap-hash-on-load
|
||||||
integration/logging
|
integration/logging
|
||||||
integration/psync2
|
integration/psync2
|
||||||
|
integration/psync2-reg
|
||||||
unit/pubsub
|
unit/pubsub
|
||||||
unit/slowlog
|
unit/slowlog
|
||||||
unit/scripting
|
unit/scripting
|
||||||
|
Loading…
x
Reference in New Issue
Block a user