Commit 89c59b74 authored by Alvaro Herrera's avatar Alvaro Herrera

Fix two-phase commit test for recovery mode

The original code had a race condition because it never ensured the
standby was caught up before proceeding; add a wait similar to every
other place that does this.

Author: Michaël Paquier
Discussion: https://postgr.es/m/CAB7nPqTm9p+LCm1mVJYvgpwagRK+uibT-pKq0O2-paOWxT62jw@mail.gmail.com
parent a6979c3a
...@@ -331,6 +331,14 @@ $cur_master->psql( ...@@ -331,6 +331,14 @@ $cur_master->psql(
CHECKPOINT; CHECKPOINT;
COMMIT PREPARED 'xact_009_13';"); COMMIT PREPARED 'xact_009_13';");
# Ensure that last transaction is replayed on standby.
my $cur_master_lsn =
$cur_master->safe_psql('postgres', "SELECT pg_current_wal_lsn()");
my $caughtup_query =
"SELECT '$cur_master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()";
$cur_standby->poll_query_until('postgres', $caughtup_query)
or die "Timed out while waiting for standby to catch up";
$cur_standby->psql( $cur_standby->psql(
'postgres', 'postgres',
"SELECT count(*) FROM t_009_tbl2", "SELECT count(*) FROM t_009_tbl2",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment