diff --git a/src/test/recovery/t/040_standby_failover_slots_sync.pl b/src/test/recovery/t/040_standby_failover_slots_sync.pl index 3059bb8177b..1627e619b1b 100644 --- a/src/test/recovery/t/040_standby_failover_slots_sync.pl +++ b/src/test/recovery/t/040_standby_failover_slots_sync.pl @@ -344,8 +344,20 @@ like( ################################################## $standby1->append_conf('postgresql.conf', "primary_conninfo = '$connstr_1'"); + +# Capture the log position before reload to check for walreceiver +# termination. +$log_offset = -s $standby1->logfile; + $standby1->reload; +# Wait for the walreceiver to be stopped and restarted after a configuration +# reload. When primary_conninfo changes, the walreceiver should be +# terminated and a new one spawned. +$standby1->wait_for_log( + qr/FATAL: .* terminating walreceiver process due to administrator command/, + $log_offset); + ($result, $stdout, $stderr) = $standby1->psql('postgres', "SELECT pg_sync_replication_slots();"); like(