summaryrefslogtreecommitdiff
path: root/mysql-test/r/xa.result
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2009-10-28 19:39:08 +0400
committerSergey Vojtovich <svoj@sun.com>2009-10-28 19:39:08 +0400
commit17ed7089756f9001d7bc6eac063d91b374de0181 (patch)
treee463afef840ef0b005614eae4b2fd868d2e051ff /mysql-test/r/xa.result
parent9a5a77eb68a35b3e806bb65f94ec9cd9ab9b1b5e (diff)
downloadmariadb-git-17ed7089756f9001d7bc6eac063d91b374de0181.tar.gz
BUG#43171 - Assertion failed: thd->transaction.xid_state.xid.is_null()
XA START may cause assertion failure/server crash when it is called after unilateral roll back issued by the Resource Manager (both in regular transaction and after XA transaction). The problem was that rm_error variable wasn't set/reset properly. mysql-test/r/xa.result: A test case for BUG#43171. mysql-test/t/xa.test: A test case for BUG#43171. sql/handler.cc: Setting rm_error when we're out of XA transaction has no special meaning. But it blocks reset of thd->transaction.xid structure later. sql/sql_parse.cc: Reset rm_error before we enter ha_rollback(), so thd->transaction.xid strucure is reinitialized.
Diffstat (limited to 'mysql-test/r/xa.result')
-rw-r--r--mysql-test/r/xa.result25
1 files changed, 25 insertions, 0 deletions
diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result
index a597806d897..d23c8e672b0 100644
--- a/mysql-test/r/xa.result
+++ b/mysql-test/r/xa.result
@@ -89,3 +89,28 @@ xa start 'a';
xa end 'a';
xa prepare 'a';
xa commit 'a';
+CREATE TABLE t1(a INT, KEY(a)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1),(2);
+BEGIN;
+UPDATE t1 SET a=3 WHERE a=1;
+BEGIN;
+UPDATE t1 SET a=4 WHERE a=2;
+UPDATE t1 SET a=5 WHERE a=2;
+UPDATE t1 SET a=5 WHERE a=1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+ROLLBACK;
+ROLLBACK;
+BEGIN;
+UPDATE t1 SET a=3 WHERE a=1;
+XA START 'xid1';
+UPDATE t1 SET a=4 WHERE a=2;
+UPDATE t1 SET a=5 WHERE a=2;
+UPDATE t1 SET a=5 WHERE a=1;
+ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
+XA END 'xid1';
+ERROR XA102: XA_RBDEADLOCK: Transaction branch was rolled back: deadlock was detected
+XA ROLLBACK 'xid1';
+XA START 'xid1';
+XA END 'xid1';
+XA ROLLBACK 'xid1';
+DROP TABLE t1;