Skip to content

Commit b6a5b76

Browse files
committed
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.
1 parent 783a21e commit b6a5b76

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/test/recovery/t/020_archive_status.pl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,14 @@
141141
'postgres', q{
142142
INSERT INTO mine SELECT generate_series(21,30) AS x;
143143
CHECKPOINT;
144-
SELECT pg_switch_wal();
145144
});
146145

147-
# Make sure that the standby has caught here.
148-
my $primary_lsn = $primary->safe_psql('postgres',
149-
q{SELECT pg_current_wal_lsn()});
146+
# Switch to a new segment and use the returned LSN to make sure that the
147+
# standby has caught up to this point.
148+
my $primary_lsn = $primary->safe_psql(
149+
'postgres', q{
150+
SELECT pg_switch_wal();
151+
});
150152
$standby1->poll_query_until('postgres',
151153
qq{ SELECT pg_wal_lsn_diff(pg_last_wal_replay_lsn(), '$primary_lsn') >= 0 },
152154
't')

0 commit comments

Comments
 (0)