| 1 |
--source include/have_debug.inc |
| 2 |
--source include/have_debug_sync.inc |
| 3 |
|
| 4 |
--echo # |
| 5 |
--echo # Bug#20872655 XA ROLLBACK IS NOT CRASH-SAFE |
| 6 |
--echo # |
| 7 |
# Will never reach debug sync point trx_xa_rollback when |
| 8 |
# xa_detach_on_prepare=ON |
| 9 |
--let CURGLOB_xa_detach_on_prepare = `SELECT @@GLOBAL.xa_detach_on_prepare` |
| 10 |
SET GLOBAL xa_detach_on_prepare = OFF; |
| 11 |
CREATE TABLE t(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=INNODB; |
| 12 |
connect (con1,localhost,root); |
| 13 |
XA START 'zombie'; |
| 14 |
insert into t(a) values (0); |
| 15 |
update t set b=a; |
| 16 |
SELECT COUNT(*) FROM t; |
| 17 |
XA END 'zombie'; |
| 18 |
XA PREPARE 'zombie'; |
| 19 |
SET DEBUG_SYNC='trx_xa_rollback SIGNAL s1 WAIT_FOR s2'; |
| 20 |
--send XA ROLLBACK 'zombie' |
| 21 |
connection default; |
| 22 |
SET DEBUG_SYNC='now WAIT_FOR s1'; |
| 23 |
# Ensure that the state change from XA PREPARE to ACTIVE gets flushed |
| 24 |
# to the redo log. Without this, it could be that we will recover to |
| 25 |
# a state that precedes the start of the XA ROLLBACK. |
| 26 |
SET GLOBAL innodb_log_checkpoint_now=ON; |
| 27 |
--source include/kill_and_restart_mysqld.inc |
| 28 |
disconnect con1; |
| 29 |
--error ER_XAER_NOTA |
| 30 |
XA COMMIT 'zombie'; |
| 31 |
SELECT COUNT(*) FROM t; |
| 32 |
DROP TABLE t; |
| 33 |
--replace_result $CURGLOB_xa_detach_on_prepare OLD_VALUE_xa_detach_on_prepare |
| 34 |
--eval SET GLOBAL xa_detach_on_prepare = $CURGLOB_xa_detach_on_prepare |