From b15039d82d4687b0714c5eca888bfe2cd3e4707e Mon Sep 17 00:00:00 2001 From: Fujii Masao Date: Tue, 21 Jul 2026 02:39:57 +0900 Subject: [PATCH v1] Fix recovery target test waiting on unavailable WAL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Buildfarm member skink reported a failure in recovery/003_recovery_targets after commit d5751c33cc3. The newly added recovery_target_xid set-then-cleared test could time out while waiting for pg_last_wal_replay_lsn() to reach the expected LSN. The test recorded lsn6 after calling pg_switch_wal(). As a result, lsn6 pointed into the next WAL segment, but pg_switch_wal() only archived the previous one. Since the standby in this test restores WAL from the archive only, it could not obtain the segment containing lsn6 and waited indefinitely. Fix this by recording lsn6 before calling pg_switch_wal(), so the archived WAL contains the LSN that the standby is waiting for. Per buildfarm member skink. Reported-by: Álvaro Herrera Author: Fujii Masao Discussion: https://postgr.es/m/al5Y2mWffRs1NP34@alvherre.pgsql --- src/test/recovery/t/003_recovery_targets.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/recovery/t/003_recovery_targets.pl b/src/test/recovery/t/003_recovery_targets.pl index 0469afb5bde..db4a0ea74b2 100644 --- a/src/test/recovery/t/003_recovery_targets.pl +++ b/src/test/recovery/t/003_recovery_targets.pl @@ -111,12 +111,12 @@ my $lsn5 = my $recovery_lsn = $node_primary->safe_psql('postgres', "INSERT INTO tab_int VALUES (generate_series(5001,6000))"); -# Force archiving of WAL file -$node_primary->safe_psql('postgres', "SELECT pg_switch_wal()"); - my $lsn6 = $node_primary->safe_psql('postgres', "SELECT pg_current_wal_lsn()"); +# Force archiving of WAL file containing $lsn6 +$node_primary->safe_psql('postgres', "SELECT pg_switch_wal()"); + # Test recovery targets my @recovery_params = ("recovery_target = 'immediate'"); test_recovery_standby('immediate target', -- 2.55.0