|
4 | 4 |
|
5 | 5 | use PostgresNode;
|
6 | 6 | use TestLib;
|
7 |
| -use Test::Moretests=>20; |
| 7 | +use Test::Moretests=>24; |
8 | 8 |
|
9 | 9 | my$psql_out ='';
|
10 | 10 | my$psql_rc ='';
|
@@ -334,6 +334,60 @@ sub configure_and_reload
|
334 | 334 | stdout=> \$psql_out);
|
335 | 335 | is($psql_out,'1',"Replay prepared transaction with DDL");
|
336 | 336 |
|
| 337 | +############################################################################### |
| 338 | +# Check recovery of prepared transaction with DDL inside after a hard restart |
| 339 | +# of the master. |
| 340 | +############################################################################### |
| 341 | + |
| 342 | +$cur_master->psql( |
| 343 | +'postgres'," |
| 344 | +BEGIN; |
| 345 | +CREATE TABLE t_009_tbl3 (id int, msg text); |
| 346 | +SAVEPOINT s1; |
| 347 | +INSERT INTO t_009_tbl3 VALUES (28, 'issued to${cur_master_name}'); |
| 348 | +PREPARE TRANSACTION 'xact_009_14'; |
| 349 | +BEGIN; |
| 350 | +CREATE TABLE t_009_tbl4 (id int, msg text); |
| 351 | +SAVEPOINT s1; |
| 352 | +INSERT INTO t_009_tbl4 VALUES (29, 'issued to${cur_master_name}'); |
| 353 | +PREPARE TRANSACTION 'xact_009_15';"); |
| 354 | + |
| 355 | +$cur_master->teardown_node; |
| 356 | +$cur_master->start; |
| 357 | + |
| 358 | +$psql_rc =$cur_master->psql('postgres',"COMMIT PREPARED 'xact_009_14'"); |
| 359 | +is($psql_rc,'0','Commit prepared transaction after teardown'); |
| 360 | + |
| 361 | +$psql_rc =$cur_master->psql('postgres',"ROLLBACK PREPARED 'xact_009_15'"); |
| 362 | +is($psql_rc,'0','Rollback prepared transaction after teardown'); |
| 363 | + |
| 364 | +############################################################################### |
| 365 | +# Check recovery of prepared transaction with DDL inside after a soft restart |
| 366 | +# of the master. |
| 367 | +############################################################################### |
| 368 | + |
| 369 | +$cur_master->psql( |
| 370 | +'postgres'," |
| 371 | +BEGIN; |
| 372 | +CREATE TABLE t_009_tbl5 (id int, msg text); |
| 373 | +SAVEPOINT s1; |
| 374 | +INSERT INTO t_009_tbl5 VALUES (30, 'issued to${cur_master_name}'); |
| 375 | +PREPARE TRANSACTION 'xact_009_16'; |
| 376 | +BEGIN; |
| 377 | +CREATE TABLE t_009_tbl6 (id int, msg text); |
| 378 | +SAVEPOINT s1; |
| 379 | +INSERT INTO t_009_tbl6 VALUES (31, 'issued to${cur_master_name}'); |
| 380 | +PREPARE TRANSACTION 'xact_009_17';"); |
| 381 | + |
| 382 | +$cur_master->stop; |
| 383 | +$cur_master->start; |
| 384 | + |
| 385 | +$psql_rc =$cur_master->psql('postgres',"COMMIT PREPARED 'xact_009_16'"); |
| 386 | +is($psql_rc,'0','Commit prepared transaction after restart'); |
| 387 | + |
| 388 | +$psql_rc =$cur_master->psql('postgres',"ROLLBACK PREPARED 'xact_009_17'"); |
| 389 | +is($psql_rc,'0','Rollback prepared transaction after restart'); |
| 390 | + |
337 | 391 | ###############################################################################
|
338 | 392 | # Verify expected data appears on both servers.
|
339 | 393 | ###############################################################################
|
|