Fix timing issue in the new tot-net-out replica test (#1060)

Apparently there is a timing issue when using wait_for_ofs_sync:
```
[exception]: Executing test client: can't read "out_before": no such variable.
can't read "out_before": no such variable
```

The reason is that if the connection between the primary
and the replica is not established yet, the master_repl_offset
of the primary and replica in wait_for_ofs_sync is 0, and
the check fails, resulting in no replica client in the
client list below.

In this case, we need to make sure the replica is online
before proceeding.

Signed-off-by: Binbin <binloveplay1314@qq.com>
This commit is contained in:
Binbin 2024-09-20 14:25:05 +08:00 committed by GitHub
parent 7fab15795f
commit d9c41e9ef9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -377,7 +377,6 @@ start_server {tags {"introspection"}} {
}
test {MONITOR log blocked command only once} {
# need to reconnect in order to reset the clients state
reconnect
@ -849,7 +848,7 @@ start_server {tags {"introspection"}} {
$replica replicaof $primary_host $primary_port
# Wait for replica to be connected before proceeding.
wait_for_ofs_sync $primary $replica
wait_replica_online $primary
# Avoid PINGs to make sure tot-net-out is stable.
$primary config set repl-ping-replica-period 3600
@ -858,9 +857,6 @@ start_server {tags {"introspection"}} {
$primary config set repl-timeout 3600
$replica config set repl-timeout 3600
# Wait for the replica to receive the command.
wait_for_ofs_sync $primary $replica
# Get the tot-net-out of the replica before sending the command.
set info_list [$primary client list]
foreach info [split $info_list "\r\n"] {