Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f9c1c60

Browse files
committed
In tests, await an LSN no later than the recovery target.
Otherwise, the test fails with "Timed out while waiting for standby to catch up". This happened rarely, perhaps only when autovacuum wrote WAL between our choosing the recovery target and choosing the LSN to await. Commit b26f7fa fixed one case of this. Fix two more. Back-patch to 9.6, which introduced the affected test. Discussion: https://postgr.es/m/20180101055227.GA2952815@rfd.leadboat.com
1 parent bd29bc4 commit f9c1c60

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/test/recovery/t/003_recovery_targets.pl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
use TestLib;
66
use Test::More tests => 7;
77

8-
# Create and test a standby from given backup, with a certain
9-
# recovery target.
8+
# Create and test a standby from given backup, with a certain recovery target.
9+
# Choose $until_lsn later than the transaction commit that causes the row
10+
# count to reach $num_rows, yet not later than the recovery target.
1011
sub test_recovery_standby
1112
{
1213
my $test_name = shift;
@@ -73,9 +74,9 @@ sub test_recovery_standby
7374
# More data, with recovery target timestamp
7475
$node_master->safe_psql('postgres',
7576
"INSERT INTO tab_int VALUES (generate_series(2001,3000))");
76-
$ret = $node_master->safe_psql('postgres',
77-
"SELECT pg_current_xlog_location(), now();");
78-
my ($lsn3, $recovery_time) = split /\|/, $ret;
77+
my $lsn3 =
78+
$node_master->safe_psql('postgres', "SELECT pg_current_xlog_location();");
79+
my $recovery_time = $node_master->safe_psql('postgres', "SELECT now()");
7980
8081
# Even more data, this time with a recovery target name
8182
$node_master->safe_psql('postgres',

0 commit comments

Comments
 (0)