| 1 |
# |
| 2 |
# Server restart with uncommitted XA transactions |
| 3 |
# |
| 4 |
|
| 5 |
--source ../have_engine.inc |
| 6 |
--source support_xa.inc |
| 7 |
|
| 8 |
# Before we start, we want to restart the server gracefully, |
| 9 |
# so GCOV information and everything else is properly stored |
| 10 |
|
| 11 |
--enable_reconnect |
| 12 |
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 13 |
restart |
| 14 |
EOF |
| 15 |
--shutdown_server |
| 16 |
--source include/wait_until_connected_again.inc |
| 17 |
|
| 18 |
|
| 19 |
call mtr.add_suppression("Found 2 prepared XA transactions"); |
| 20 |
if (!$support_xa) |
| 21 |
{ |
| 22 |
--disable_query_log |
| 23 |
call mtr.add_suppression("Table '.*t1' is marked as crashed and should be repaired"); |
| 24 |
call mtr.add_suppression("Checking table: '.*t1'"); |
| 25 |
--enable_query_log |
| 26 |
} |
| 27 |
|
| 28 |
# Close all unused tables to prevent unrelated corruption |
| 29 |
FLUSH TABLES; |
| 30 |
|
| 31 |
--disable_warnings |
| 32 |
DROP TABLE IF EXISTS t1; |
| 33 |
--enable_warnings |
| 34 |
|
| 35 |
--connect (con1,localhost,root,,) |
| 36 |
--connect (con2,localhost,root,,) |
| 37 |
|
| 38 |
--connection con1 |
| 39 |
--let $create_definition = a $int_col |
| 40 |
--source ../create_table.inc |
| 41 |
|
| 42 |
XA START 'xa1'; |
| 43 |
INSERT INTO t1 (a) VALUES (1),(2); |
| 44 |
XA END 'xa1'; |
| 45 |
XA PREPARE 'xa1'; |
| 46 |
|
| 47 |
--connection con2 |
| 48 |
XA START 'xa2'; |
| 49 |
INSERT INTO t1 (a) VALUES (3); |
| 50 |
INSERT INTO t1 (a) VALUES (4); |
| 51 |
XA END 'xa2'; |
| 52 |
XA PREPARE 'xa2'; |
| 53 |
|
| 54 |
--connection default |
| 55 |
--enable_reconnect |
| 56 |
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 57 |
wait |
| 58 |
EOF |
| 59 |
--shutdown_server 0 |
| 60 |
--source include/wait_until_disconnected.inc |
| 61 |
|
| 62 |
--append_file $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
| 63 |
restart |
| 64 |
EOF |
| 65 |
--source include/wait_until_connected_again.inc |
| 66 |
XA RECOVER; |
| 67 |
XA ROLLBACK 'xa1'; |
| 68 |
XA COMMIT 'xa2'; |
| 69 |
--replace_result \\ / |
| 70 |
SELECT a FROM t1; |
| 71 |
DROP TABLE t1; |
| 72 |
|
| 73 |
--source ../cleanup_engine.inc |
| 74 |
|