Skip to content

Commit 5d41031

Browse files
committed
one more test case
1 parent 8ee59ff commit 5d41031

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

src/test/recovery/t/006_twophase.pl renamed to src/test/recovery/t/007_twophase.pl

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
use warnings;
33
use PostgresNode;
44
use TestLib;
5-
use Test::More tests => 11;
5+
use Test::More tests => 12;
66

77
# Setup master node
88
my $node_master = get_new_node("Candie");
@@ -21,13 +21,33 @@
2121

2222
# Switch to synchronous replication
2323
$node_master->append_conf('postgresql.conf', qq(
24-
synchronous_standby_names = '*'
24+
synchronous_standby_names = '*'
2525
));
2626
$node_master->psql('postgres', "select pg_reload_conf()");
2727

2828
my $psql_out = '';
2929
my $psql_rc = '';
3030

31+
32+
33+
34+
35+
$node_master->psql('postgres', "
36+
begin;
37+
insert into t values (1);
38+
prepare transaction 'x';
39+
");
40+
$node_slave->teardown_node;
41+
$node_master->psql('postgres',"commit prepared 'x'");
42+
$node_slave->start;
43+
$node_slave->psql('postgres',"select count(*) from pg_prepared_xacts", stdout => \$psql_out);
44+
is($psql_out, '0', "Commit prepared on master while slave is down.");
45+
46+
47+
48+
49+
50+
3151
###############################################################################
3252
# Check that we can commit and abort tx after soft restart.
3353
# Here checkpoint happens before shutdown and no WAL replay will not occur
@@ -223,3 +243,14 @@
223243
$node_master->psql('postgres',"commit prepared 'x'");
224244

225245

246+
###############################################################################
247+
# Commit prepared on master while slave is down.
248+
###############################################################################
249+
250+
# Switch to asynchronous replication
251+
#$node_master->append_conf('postgresql.conf', qq(
252+
# synchronous_standby_names = ''
253+
#));
254+
#$node_master->psql('postgres', "select pg_reload_conf()");
255+
256+

0 commit comments

Comments
 (0)