| 1 |
############################################################################### |
| 2 |
# Bug#26618925 XA ROLLBACK WITH WRONG XID WILL BE RECORDED INTO THE BINLOG |
| 3 |
# |
| 4 |
# Problem: XA ROLLBACK is getting binlogged even when it is failed. |
| 5 |
# |
| 6 |
# Steps to reproduce: |
| 7 |
# 1) Prepare XA transaction with some sample data with XA global Trx id '1'. |
| 8 |
# 2) Try to do 'XA ROLLBACK' with XA global Trx id '2' and check that it fails. |
| 9 |
# 3) Check that nothing is written to binary log |
| 10 |
# 4) Cleanup |
| 11 |
############################################################################### |
| 12 |
--source include/have_log_bin.inc |
| 13 |
--source include/have_binlog_format_row.inc |
| 14 |
|
| 15 |
CREATE TABLE t1(id INT PRIMARY KEY); |
| 16 |
|
| 17 |
--echo # |
| 18 |
--echo # 1) Prepare XA transaction with some sample data with |
| 19 |
--echo # XA global Trx id '1'. |
| 20 |
--echo # |
| 21 |
XA START '1'; |
| 22 |
INSERT INTO t1 VALUES (1); |
| 23 |
XA END '1'; |
| 24 |
XA PREPARE '1'; |
| 25 |
|
| 26 |
--echo # |
| 27 |
--echo # 2) Try to do 'XA ROLLBACK' with XA global Trx id '2' and check that |
| 28 |
--echo # it fails. |
| 29 |
--echo # |
| 30 |
let $binlog_before_xa_rollback = query_get_value(SHOW MASTER STATUS, Position, 1); |
| 31 |
|
| 32 |
--disable_result_log |
| 33 |
--let $xa_error = ER_XAER_RMFAIL |
| 34 |
if (`SELECT @@GLOBAL.xa_detach_on_prepare = 1`) { |
| 35 |
--let $xa_error = ER_XAER_NOTA |
| 36 |
} |
| 37 |
--error $xa_error |
| 38 |
XA ROLLBACK '2'; |
| 39 |
--enable_result_log |
| 40 |
|
| 41 |
--echo # |
| 42 |
--echo # 3) Check that nothing is written to binary log. |
| 43 |
--echo # |
| 44 |
--let $assert_text= Nothing should be written in binlog for failed XA ROLLBACK. |
| 45 |
--let $assert_cond= [SHOW MASTER STATUS, Position, 1] = $binlog_before_xa_rollback |
| 46 |
--source include/assert.inc |
| 47 |
|
| 48 |
--echo # |
| 49 |
--echo # 4) Cleanup. |
| 50 |
--echo # |
| 51 |
XA COMMIT '1'; |
| 52 |
DROP TABLE t1; |