File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1+ use strict;
2+ use warnings;
3+ use PostgresNode;
4+ use TestLib;
5+ use Test::More tests => 1;
6+
7+ # Setup master node
8+ my $node_master = get_new_node(" master" );
9+ $node_master -> init(allows_streaming => 1);
10+ $node_master -> append_conf(' postgresql.conf' , qq(
11+ max_prepared_transactions = 10
12+ ) );
13+ $node_master -> start;
14+ $node_master -> backup(' master_backup' );
15+ $node_master -> psql(' postgres' , " create table t(id int)" );
16+
17+ # Setup slave node
18+ my $node_slave = get_new_node(' slave' );
19+ $node_slave -> init_from_backup($node_master , ' master_backup' , has_streaming => 1);
20+ $node_slave -> start;
21+
22+ my $psql_out = ' ' ;
23+ my $psql_rc = ' ' ;
24+
25+ $node_master -> psql(' postgres' , "
26+ begin;
27+ create table t2(id int);
28+ prepare transaction 'x';
29+ " );
30+ sleep 2; # wait for changes to arrive on slave
31+ $node_slave -> teardown_node;
32+
33+ # $node_slave->stop;
34+
35+ $node_master -> psql(' postgres' ," commit prepared 'x'" );
36+ $node_slave -> start;
37+ $node_slave -> psql(' postgres' ," select count(*) from pg_prepared_xacts" , stdout => \$psql_out );
38+ is($psql_out , ' 0' , " Commit prepared on master while slave is down." );
39+
You can’t perform that action at this time.
0 commit comments