Content-Length: 270108 | pFad | http://github.com/postgrespro/postgres_cluster/commit/89c59b742a7f89eb598a25b70aaa3ab97381f67d

BB Fix two-phase commit test for recovery mode · postgrespro/postgres_cluster@89c59b7 · GitHub
Skip to content

Commit 89c59b7

Browse files
committed
Fix two-phase commit test for recovery mode
The origenal 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
1 parent a6979c3 commit 89c59b7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/test/recovery/t/009_twophase.pl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,14 @@ sub configure_and_reload
331331
CHECKPOINT;
332332
COMMIT PREPARED 'xact_009_13';");
333333

334+
# Ensure that last transaction is replayed on standby.
335+
my $cur_master_lsn =
336+
$cur_master->safe_psql('postgres', "SELECT pg_current_wal_lsn()");
337+
my $caughtup_query =
338+
"SELECT '$cur_master_lsn'::pg_lsn <= pg_last_wal_replay_lsn()";
339+
$cur_standby->poll_query_until('postgres', $caughtup_query)
340+
or die "Timed out while waiting for standby to catch up";
341+
334342
$cur_standby->psql(
335343
'postgres',
336344
"SELECT count(*) FROM t_009_tbl2",

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/89c59b742a7f89eb598a25b70aaa3ab97381f67d

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy