Details
Description
This issue was identified while analyzing MDEV-37117. After a deadlock and rollback error within an XA transaction, we are allowing DML like INSERT to be executed successfully. This is derived from the same testcase from the other bug.
--source include/have_innodb.inc
|
|
CREATE TABLE t1 (a INT) ENGINE=InnoDB; |
INSERT INTO t1 VALUES (1),(2) ; |
CREATE TABLE t2 (b INT) ENGINE=InnoDB; |
CREATE TABLE t3 (c INT) ENGINE=InnoDB; |
|
INSERT INTO t3 VALUES (1),(2); |
|
--connect (con1,localhost,root,,)
|
XA BEGIN 'x1'; |
|
--connection default
|
XA BEGIN 'x2'; |
|
DELETE FROM t1; |
--connection con1
|
|
DELETE FROM t3 WHERE c = 2; |
--connection default
|
|
--send
|
DELETE FROM t3; |
|
--connection con1
|
--error ER_LOCK_DEADLOCK
|
DELETE FROM t1; |
INSERT INTO t2 VALUES (1); |
SELECT * FROM t2; |
|
# Cleanup
|
--error ER_XA_RBDEADLOCK
|
XA END 'x1'; |
|
--disconnect con1
|
--connection default
|
|
--reap
|
|
XA END 'x2'; |
XA ROLLBACK 'x2'; |
|
SELECT * FROM t2; |
|
DROP TABLE t1, t2, t3; |
Here, the INSERT statement after a deadlock error runs successfully and is also committed when the XA transaction block is rolled back. This is a functional issue. The INSERT and any other DML should report ER_XA_RBDEADLOCK.
This is not any regression and is inherited from MySQL 5.6 Somewhat similar issue is fixed in MySQL 5.7 by following commit.
commit 5708f0b18f1f724fe1ef6ab5aaf35dea100d8ae7
|
Author: Karthik Kamath <karthik.kamath@oracle.com>
|
Date: Tue Apr 6 21:48:10 2021 +0530
|
|
BUG#32707060: INCONSISTENT BINLOG CAUSES ON REPLICA ERROR
|
'XAER_RMFAIL: THE COMMAND CANNOT BE EXECUTED
|
WHEN GLOBAL TRANSACTION IS IN THE ACTIVE STATE'
|
We might want to fix this in 12.x versions and backport to any lower version on need.
Attachments
Issue Links
- relates to
-
MDEV-37117 Assertion `!thd->transaction->xid_state.is_explicit_XA() || thd->lex->xa_opt == XA_ONE_PHASE' failed after deadlock between XA
-
- Closed
-
-
MDEV-37560 trx_deadlock sporadic failure on MDEV-37141 test case
-
- Closed
-
-
MDEV-37426 innodb.trx_deadlock fails : query 'UPDATE ...' succeeded - should have failed with error ER_LOCK_DEADLOCK (1213).
-
- Open
-