diff --git a/src/test/recovery/t/009_twophase.pl b/src/test/recovery/t/009_twophase.pl index 93d0e974c4..6d4bd3608b 100644 --- a/src/test/recovery/t/009_twophase.pl +++ b/src/test/recovery/t/009_twophase.pl @@ -4,11 +4,25 @@ use warnings; use PostgresNode; use TestLib; -use Test::More tests => 17; +use Test::More tests => 18; my $psql_out = ''; my $psql_rc = ''; +sub configure_and_reload +{ + my ($node, $parameter) = @_; + my $name = $node->name; + + $node->append_conf( + 'postgresql.conf', qq( + $parameter + )); + $node->psql('postgres', "SELECT pg_reload_conf()", + stdout => \$psql_out); + is($psql_out, 't', 'reload $parameter in postgresql.conf of node "$name"'); +} + # Set up two nodes, which will alternately be master and replication slave. # Setup london node @@ -28,14 +42,9 @@ $node_paris->init_from_backup($node_london, 'london_backup', has_streaming => 1); $node_paris->start; -# Switch to synchronous replication -$node_london->append_conf( - 'postgresql.conf', qq( - synchronous_standby_names = '*' -)); -$node_london->psql('postgres', "SELECT pg_reload_conf()", - stdout => \$psql_out); -is($psql_out, 't', 'Enable synchronous replication'); +# Switch to synchronous replication both nodes +configure_and_reload($node_london, "synchronous_standby_names = '*'"); +configure_and_reload($node_paris, "synchronous_standby_names = '*'"); note "Initially, london is master and paris is slave"; my ($cur_master, $cur_slave) = ($node_london, $node_paris); @@ -213,7 +222,9 @@ note "Now paris is master and london is slave"; ($cur_master, $cur_slave) = ($node_paris, $node_london); $cur_master_name = $cur_master->name; -$psql_rc = $cur_master->psql('postgres', "COMMIT PREPARED 'xact_009_10'"); +# standby is disconnected, so disable synchronous commit temporarily +$psql_rc = $cur_master->psql('postgres', + "SET synchronous_commit = off; COMMIT PREPARED 'xact_009_10';"); is($psql_rc, '0', "Restore of prepared transaction on promoted slave"); # restart old master as new slave @@ -309,8 +320,8 @@ $cur_slave->start; $cur_master->psql('postgres', "COMMIT PREPARED 'xact_009_12'"); ############################################################################### -# Check for a lock conflict between prepared transaction with DDL inside and replay of -# XLOG_STANDBY_LOCK wal record. +# Check for a lock conflict between prepared transaction with DDL inside and +# replay of XLOG_STANDBY_LOCK wal record. ############################################################################### $cur_master->psql(