solve race conditions in psync2-pingoff test (#8720)

Another test race condition in the macos tests.
the test was waiting for PINGs to be generated and put on the replication stream,
but waiting for 1 or 2 seconds doesn't really guarantee that.
then the test that expected 6 full syncs, found only 4
This commit is contained in:
Oran Agra 2021-03-30 11:41:06 +03:00 committed by GitHub
parent 65311a3360
commit cd81dcf18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,7 +111,13 @@ start_server {} {
$replica1 replicaof no one $replica1 replicaof no one
$replica2 replicaof 127.0.0.1 1 ;# we can't promote it to master since that will cycle the replication id $replica2 replicaof 127.0.0.1 1 ;# we can't promote it to master since that will cycle the replication id
$master config set repl-ping-replica-period 1 $master config set repl-ping-replica-period 1
after 1500 set replofs [status $master master_repl_offset]
wait_for_condition 50 100 {
[status $replica3 master_repl_offset] > $replofs &&
[status $replica4 master_repl_offset] > $replofs
} else {
fail "replica didn't sync in time"
}
# make everyone sync from the replica1 that didn't get the last ping from the old master # make everyone sync from the replica1 that didn't get the last ping from the old master
# replica4 will keep syncing from the old master which now syncs from replica1 # replica4 will keep syncing from the old master which now syncs from replica1
@ -195,10 +201,16 @@ start_server {} {
fail "Chained replica not replicating from its master" fail "Chained replica not replicating from its master"
} }
# Do a write on the master, and wait for 3 seconds for the master to # Do a write on the master, and wait for the master to
# send some PINGs to its replica # send some PINGs to its replica
$R(0) INCR counter2 $R(0) INCR counter2
after 2000 set replofs [status $R(0) master_repl_offset]
wait_for_condition 50 100 {
[status $R(1) master_repl_offset] > $replofs &&
[status $R(2) master_repl_offset] > $replofs
} else {
fail "replica didn't sync in time"
}
set sync_partial_master [status $R(0) sync_partial_ok] set sync_partial_master [status $R(0) sync_partial_ok]
set sync_partial_replica [status $R(1) sync_partial_ok] set sync_partial_replica [status $R(1) sync_partial_ok]
$R(0) CONFIG SET repl-ping-replica-period 100 $R(0) CONFIG SET repl-ping-replica-period 100