diff --git a/src/test/recovery/t/004_timeline_switch.pl b/src/test/recovery/t/004_timeline_switch.pl index 5afd2f44466..85df9ad422c 100644 --- a/src/test/recovery/t/004_timeline_switch.pl +++ b/src/test/recovery/t/004_timeline_switch.pl @@ -48,10 +48,11 @@ $node_standby_1->psql( is($psql_out, 't', "promotion of standby with pg_promote"); # Switch standby 2 to replay from standby 1 +my $secret = 'dont_show_me'; my $connstr_1 = $node_standby_1->connstr; $node_standby_2->append_conf( 'postgresql.conf', qq( -primary_conninfo='$connstr_1' +primary_conninfo='$connstr_1 password=$secret' )); # Rotate logfile before restarting, for the log checks done below. @@ -62,9 +63,9 @@ $node_standby_2->restart; # verify that after reconnection, the walreceiver stays alive during # the timeline switch. $node_standby_2->poll_query_until('postgres', - "SELECT EXISTS(SELECT 1 FROM pg_stat_wal_receiver)"); + "SELECT EXISTS(SELECT 1 FROM pg_stat_activity WHERE backend_type = 'walreceiver')"); my $wr_pid_before_switch = $node_standby_2->safe_psql('postgres', - "SELECT pid FROM pg_stat_wal_receiver"); + "SELECT pid FROM pg_stat_activity WHERE backend_type = 'walreceiver'"); # Insert some data in standby 1 and check its presence in standby 2 # to ensure that the timeline switch has been done. @@ -88,11 +89,19 @@ ok( !$node_standby_2->log_contains( # Verify that the walreceiver process stayed alive across the timeline # switch, check its PID. my $wr_pid_after_switch = $node_standby_2->safe_psql('postgres', - "SELECT pid FROM pg_stat_wal_receiver"); + "SELECT pid FROM pg_stat_activity WHERE backend_type = 'walreceiver'"); is($wr_pid_before_switch, $wr_pid_after_switch, 'WAL receiver PID matches across timeline jumps'); +my $raw_conninfo_count = $node_standby_2->safe_psql( + 'postgres', + "SELECT count(*) FROM pg_stat_wal_receiver WHERE conninfo LIKE '%$secret%'"); + +is( + $raw_conninfo_count, '0', + 'raw primary_conninfo password is not visible after timeline jumps'); + # Ensure that a standby is able to follow a primary on a newer timeline # when WAL archiving is enabled.