Skip to content

Commit 989df85

Browse files
committed
[fix] flaky17 replication-psync.tcl shutdown.tcl
1 parent 1f9309c commit 989df85

2 files changed

Lines changed: 29 additions & 10 deletions

File tree

tests/swap/ported/integration/replication-psync.tcl

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,19 @@ proc test_psync {descr duration backlog_size backlog_ttl delay cond mdl sdl bgsa
2525
$master config set swap-debug-swapout-notify-delay-micro 10000
2626
$slave config set repl-diskless-load $sdl
2727

28-
set load_handle0 [start_bg_complex_data $master_host $master_port 0 100000]
29-
set load_handle1 [start_bg_complex_data $master_host $master_port 0 100000]
30-
set load_handle2 [start_bg_complex_data $master_host $master_port 0 100000]
28+
# Diskless swapdb/disabled loads are much slower under ASAN.
29+
# Raise repl-timeout so a slow full sync doesn't livelock.
30+
if {$::swap && $::asan} {
31+
$master config set repl-timeout 600
32+
$slave config set repl-timeout 600
33+
}
34+
35+
# Keep the dataset large enough to overflow tiny backlogs, but small
36+
# enough that swap+asan full resyncs can finish within the timeout.
37+
set bg_limit [expr {$::asan ? 5000 : 100000}]
38+
set load_handle0 [start_bg_complex_data $master_host $master_port 0 $bg_limit]
39+
set load_handle1 [start_bg_complex_data $master_host $master_port 0 $bg_limit]
40+
set load_handle2 [start_bg_complex_data $master_host $master_port 0 $bg_limit]
3141
test {Slave should be able to synchronize with the master} {
3242
$slave slaveof $master_host $master_port
3343
wait_for_condition 50 1000 {
@@ -75,7 +85,8 @@ proc test_psync {descr duration backlog_size backlog_ttl delay cond mdl sdl bgsa
7585

7686
# Wait for the slave to reach the "online"
7787
# state from the POV of the master.
78-
wait_slave_online $master 5000 100 {
88+
set maxwait [expr {($::swap && $::asan) ? 6000 : 5000}]
89+
wait_slave_online $master $maxwait 100 {
7990
error "assertion:Slave not correctly synchronized"
8091
}
8192

tests/unit/shutdown.tcl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,25 @@ start_server {tags {"shutdown"}} {
33
for {set i 0} {$i < 20} {incr i} {
44
r set $i $i
55
}
6-
# It will cost 2s(20 * 100ms) to dump rdb
7-
r config set rdb-key-save-delay 100000
6+
r config set rdb-key-save-delay 10000000
87

98
# Child is dumping rdb
109
r bgsave
11-
after 100
10+
wait_for_condition 1000 10 {
11+
[s rdb_bgsave_in_progress] eq 1
12+
} else {
13+
fail "bgsave did not start in time"
14+
}
15+
1216
set dir [lindex [r config get dir] 1]
1317
set child_pid [get_child_pid 0]
14-
set temp_rdb [file join [lindex [r config get dir] 1] temp-${child_pid}.rdb]
15-
# Temp rdb must be existed
16-
assert {[file exists $temp_rdb]}
18+
set temp_rdb [file join $dir temp-${child_pid}.rdb]
19+
# Wait for the child to actually create the temp rdb file.
20+
wait_for_condition 1000 10 {
21+
[file exists $temp_rdb]
22+
} else {
23+
fail "Temp rdb was not created in time"
24+
}
1725

1826
catch {r shutdown nosave}
1927
# Make sure the server was killed

0 commit comments

Comments
 (0)