|
2 | 2 | use warnings; |
3 | 3 | use PostgresNode; |
4 | 4 | use TestLib; |
5 | | -use Test::More tests => 11; |
| 5 | +use Test::More tests => 12; |
6 | 6 |
|
7 | 7 | # Setup master node |
8 | 8 | my $node_master = get_new_node("master"); |
9 | 9 | $node_master->init(allows_streaming => 1); |
10 | 10 | $node_master->append_conf('postgresql.conf', qq( |
11 | | -max_prepared_transactions = 10 |
| 11 | + max_prepared_transactions = 10 |
12 | 12 | )); |
13 | 13 | $node_master->start; |
14 | 14 | $node_master->backup('master_backup'); |
|
224 | 224 |
|
225 | 225 |
|
226 | 226 | ############################################################################### |
227 | | -# Commit prepared on master while slave is down. |
| 227 | +# Check for a lock confcict between prepared tx with DDL inside and replay of |
| 228 | +# XLOG_STANDBY_LOCK wal record. |
228 | 229 | ############################################################################### |
229 | 230 |
|
230 | | -# Switch to asynchronous replication |
231 | | -#$node_master->append_conf('postgresql.conf', qq( |
232 | | -# synchronous_standby_names = '' |
233 | | -#)); |
234 | | -#$node_master->psql('postgres', "select pg_reload_conf()"); |
| 231 | +$node_master->psql('postgres', " |
| 232 | + begin; |
| 233 | + create table t2(id int); |
| 234 | + prepare transaction 'x'; |
| 235 | + -- checkpoint will issue XLOG_STANDBY_LOCK that can conflict with lock |
| 236 | + -- held by 'create table' statement |
| 237 | + checkpoint; |
| 238 | + commit prepared 'x'; |
| 239 | +"); |
235 | 240 |
|
| 241 | +$node_slave->psql('postgres',"select count(*) from pg_prepared_xacts", stdout => \$psql_out); |
| 242 | +is($psql_out, '0', "Replay tx with DDL"); |
236 | 243 |
|
0 commit comments