Skip to content

Commit 1a8b110

Browse files
committed
Fix second race condition in 002_archiving.pl with archive_cleanup_command
Checking the execution of archive_cleanup_command on a standby requires a valid checkpoint coming from its primary, but the logic did not check that the standby replayed up to the point of the checkpoint, causing the test checking for the execution of archive_cleanup_command to fail. This race was more visible in slow environments. Issue introduced in 46dea24, so no backpatch is needed. Author: Tom Lane Discussion: https://postgr.es/m/4015413.1649454951@sss.pgh.pa.us
1 parent 676eeb6 commit 1a8b110

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/test/recovery/t/002_archiving.pl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,16 @@
4646
# Create some content on primary
4747
$node_primary->safe_psql('postgres',
4848
"CREATE TABLE tab_int AS SELECT generate_series(1,1000) AS a");
49-
my $current_lsn =
50-
$node_primary->safe_psql('postgres', "SELECT pg_current_wal_lsn();");
5149

5250
# Note the presence of this checkpoint for the archive_cleanup_command
5351
# check done below, before switching to a new segment.
5452
$node_primary->safe_psql('postgres', "CHECKPOINT");
5553

54+
# Done after the checkpoint to ensure that it is replayed on the standby,
55+
# for archive_cleanup_command.
56+
my $current_lsn =
57+
$node_primary->safe_psql('postgres', "SELECT pg_current_wal_lsn();");
58+
5659
# Force archiving of WAL file to make it present on primary
5760
$node_primary->safe_psql('postgres', "SELECT pg_switch_wal()");
5861

0 commit comments

Comments
 (0)