summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNoah Misch <noah@leadboat.com>2017-12-31 21:58:29 -0800
committerNoah Misch <noah@leadboat.com>2017-12-31 22:01:27 -0800
commitf9c1c6099519609aceb54fc5366f096a0b1e1b41 (patch)
tree40dbfeef217e1684c56efc70f7b8987748299ee9 /src
parentbd29bc417e7130312b47ba0da244c020a0193694 (diff)
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 b26f7fa6ae2b4e5d64525b3d5bc66a0ddccd9e24 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
Diffstat (limited to 'src')
-rw-r--r--src/test/recovery/t/003_recovery_targets.pl11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/test/recovery/t/003_recovery_targets.pl b/src/test/recovery/t/003_recovery_targets.pl
index d1f6d78388b..fd759525d38 100644
--- a/src/test/recovery/t/003_recovery_targets.pl
+++ b/src/test/recovery/t/003_recovery_targets.pl
@@ -5,8 +5,9 @@ use PostgresNode;
use TestLib;
use Test::More tests => 7;
-# Create and test a standby from given backup, with a certain
-# recovery target.
+# Create and test a standby from given backup, with a certain recovery target.
+# Choose $until_lsn later than the transaction commit that causes the row
+# count to reach $num_rows, yet not later than the recovery target.
sub test_recovery_standby
{
my $test_name = shift;
@@ -73,9 +74,9 @@ my ($lsn2, $recovery_txid) = split /\|/, $ret;
# More data, with recovery target timestamp
$node_master->safe_psql('postgres',
"INSERT INTO tab_int VALUES (generate_series(2001,3000))");
-$ret = $node_master->safe_psql('postgres',
- "SELECT pg_current_xlog_location(), now();");
-my ($lsn3, $recovery_time) = split /\|/, $ret;
+my $lsn3 =
+ $node_master->safe_psql('postgres', "SELECT pg_current_xlog_location();");
+my $recovery_time = $node_master->safe_psql('postgres', "SELECT now()");
# Even more data, this time with a recovery target name
$node_master->safe_psql('postgres',