summaryrefslogtreecommitdiff
path: root/tests/integration/psync2.tcl
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2020-03-05 16:55:14 +0200
committerantirez <antirez@gmail.com>2020-03-12 15:53:47 +0100
commit6173815408a379c5a060283c589e83c8f2f1134f (patch)
treebad1ad73937aeebdf1c91b1de97028ebf5508aba /tests/integration/psync2.tcl
parent70e0e49952ef40675b515a9483767be898640609 (diff)
downloadredis-6173815408a379c5a060283c589e83c8f2f1134f.tar.gz
fix for flaky psync2 test
*** [err]: PSYNC2: total sum of full synchronizations is exactly 4 in tests/integration/psync2.tcl Expected 5 == 4 (context: type eval line 6 cmd {assert {$sum == 4}} proc ::test) issue was that sometime the test got an unexpected full sync since it tried to switch to the replica before it was in sync with it's master.
Diffstat (limited to 'tests/integration/psync2.tcl')
-rw-r--r--tests/integration/psync2.tcl21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/integration/psync2.tcl b/tests/integration/psync2.tcl
index d1212b640..333736ffa 100644
--- a/tests/integration/psync2.tcl
+++ b/tests/integration/psync2.tcl
@@ -114,6 +114,27 @@ start_server {} {
}
}
+ # wait for all the slaves to be in sync with the master
+ set master_ofs [status $R($master_id) master_repl_offset]
+ wait_for_condition 500 100 {
+ $master_ofs == [status $R(0) master_repl_offset] &&
+ $master_ofs == [status $R(1) master_repl_offset] &&
+ $master_ofs == [status $R(2) master_repl_offset] &&
+ $master_ofs == [status $R(3) master_repl_offset] &&
+ $master_ofs == [status $R(4) master_repl_offset]
+ } else {
+ if {$debug_msg} {
+ for {set j 0} {$j < 5} {incr j} {
+ puts "$j: sync_full: [status $R($j) sync_full]"
+ puts "$j: id1 : [status $R($j) master_replid]:[status $R($j) master_repl_offset]"
+ puts "$j: id2 : [status $R($j) master_replid2]:[status $R($j) second_repl_offset]"
+ puts "$j: backlog : firstbyte=[status $R($j) repl_backlog_first_byte_offset] len=[status $R($j) repl_backlog_histlen]"
+ puts "---"
+ }
+ }
+ fail "Slaves are not in sync with the master after too long time."
+ }
+
# Put down the old master so that it cannot generate more
# replication stream, this way in the next master switch, the time at
# which we move slaves away is not important, each will have full