diff options
author | Noah Misch <noah@leadboat.com> | 2020-09-13 23:13:44 -0700 |
---|---|---|
committer | Noah Misch <noah@leadboat.com> | 2020-09-13 23:14:56 -0700 |
commit | e09391a0a042a631de05faa195aea86acc66ba43 (patch) | |
tree | fb99e0df4f32600b48bad7545c1d5bb9060c536e /src | |
parent | 1a9c93ec3b9ae2766b60e97957d07028e2828796 (diff) |
Fix race in test of pg_switch_wal().
The test failed when something added WAL between pg_switch_wal() and
pg_current_wal_lsn(), seen on buildfarm members hornet and sungazer.
Fix v10, v9.6 and v9.5 by making this code mirror its v13+ counterpart.
v12 and v11 lack a counterpart.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/recovery/t/020_archive_status.pl | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/test/recovery/t/020_archive_status.pl b/src/test/recovery/t/020_archive_status.pl index 4f63962959c..09b9eba7b95 100644 --- a/src/test/recovery/t/020_archive_status.pl +++ b/src/test/recovery/t/020_archive_status.pl @@ -141,12 +141,14 @@ $primary->safe_psql( 'postgres', q{ INSERT INTO mine SELECT generate_series(21,30) AS x; CHECKPOINT; - SELECT pg_switch_xlog(); }); -# Make sure that the standby has caught here. -my $primary_lsn = $primary->safe_psql('postgres', - q{SELECT pg_current_xlog_location()}); +# Switch to a new segment and use the returned LSN to make sure that the +# standby has caught up to this point. +my $primary_lsn = $primary->safe_psql( + 'postgres', q{ + SELECT pg_switch_xlog(); +}); $standby1->poll_query_until('postgres', qq{ SELECT pg_xlog_location_diff(pg_last_xlog_replay_location(), '$primary_lsn') >= 0 }) or die "Timed out while waiting for xlog replay"; |