|
54 | 54 | 'postgresql.conf', qq( |
55 | 55 | primary_conninfo='$connstr_1' |
56 | 56 | )); |
| 57 | + |
| 58 | +# Rotate logfile before restarting, for the log checks done below. |
| 59 | +$node_standby_2->rotate_logfile; |
57 | 60 | $node_standby_2->restart; |
58 | 61 |
|
| 62 | +# Wait for walreceiver to reconnect after the restart. We want to |
| 63 | +# verify that after reconnection, the walreceiver stays alive during |
| 64 | +# the timeline switch. |
| 65 | +$node_standby_2->poll_query_until('postgres', |
| 66 | + "SELECT EXISTS(SELECT 1 FROM pg_stat_wal_receiver)"); |
| 67 | +my $wr_pid_before_switch = $node_standby_2->safe_psql('postgres', |
| 68 | + "SELECT pid FROM pg_stat_wal_receiver"); |
| 69 | + |
59 | 70 | # Insert some data in standby 1 and check its presence in standby 2 |
60 | 71 | # to ensure that the timeline switch has been done. |
61 | 72 | $node_standby_1->safe_psql('postgres', |
|
75 | 86 | ), |
76 | 87 | 'WAL receiver should not be stopped across timeline jumps'); |
77 | 88 |
|
| 89 | +# Verify that the walreceiver process stayed alive across the timeline |
| 90 | +# switch, check its PID. |
| 91 | +my $wr_pid_after_switch = $node_standby_2->safe_psql('postgres', |
| 92 | + "SELECT pid FROM pg_stat_wal_receiver"); |
| 93 | + |
| 94 | +is($wr_pid_before_switch, $wr_pid_after_switch, |
| 95 | + 'WAL receiver PID matches across timeline jumps'); |
| 96 | + |
78 | 97 | # Ensure that a standby is able to follow a primary on a newer timeline |
79 | 98 | # when WAL archiving is enabled. |
80 | 99 |
|
|
0 commit comments