postgres.git / summary / log / commit / refs

commit    b6a5b766b3e5b7bd25e9d0db60a60657df2aa97e
Author:   Noah Misch <noah@leadboat.com>
Date:     Mon Sep 14 06:13:44 2020 +0000
First released in: 9.5.24, 9.6.20, 10.15

    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.


src/test/recovery/t/020_archive_status.pl | 10 ++++++---- 1 file 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 d79c0caf908..b6912981027 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_wal(); }); -# Make sure that the standby has caught here. -my $primary_lsn = $primary->safe_psql('postgres', - q{SELECT pg_current_wal_lsn()}); +# 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_wal(); +}); $standby1->poll_query_until('postgres', qq{ SELECT pg_wal_lsn_diff(pg_last_wal_replay_lsn(), '$primary_lsn') >= 0 }, 't') [parent: 783a21eff37e]