summaryrefslogtreecommitdiff
path: root/mysql-test/t/xa.test
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@sun.com>2010-03-10 15:04:32 +0400
committerSergey Vojtovich <svoj@sun.com>2010-03-10 15:04:32 +0400
commit405fd822075488597484ef5ce82a8d3296262130 (patch)
treef5d8084d539e0d15f67adc081d76d21e3effc94c /mysql-test/t/xa.test
parent05ff7b65f072d69a67515b8c0c6731f358a846ca (diff)
downloadmariadb-git-405fd822075488597484ef5ce82a8d3296262130.tar.gz
BUG#51342 - more xid crashing
SET autocommit=1 while XA transaction is active may cause various side effects, including memory corruption and server crash. The problem is that SET autocommit=1 and further queries attempt to commit local transaction, whereas XA transaction is still active. As local and XA transactions are mutually exclusive, this patch forbids enabling autocommit mode while XA transaction is active. mysql-test/r/xa.result: A test case for BUG#51342. mysql-test/t/xa.test: A test case for BUG#51342. sql/set_var.cc: Forbid enabling autocommit mode while XA transaction is active.
Diffstat (limited to 'mysql-test/t/xa.test')
-rw-r--r--mysql-test/t/xa.test16
1 files changed, 16 insertions, 0 deletions
diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test
index 04ecf518577..d5def009172 100644
--- a/mysql-test/t/xa.test
+++ b/mysql-test/t/xa.test
@@ -122,6 +122,22 @@ xa start 'a','c';
--connection default
drop table t1;
+--echo #
+--echo # BUG#51342 - more xid crashing
+--echo #
+CREATE TABLE t1(a INT) ENGINE=InnoDB;
+XA START 'x';
+SET SESSION autocommit=0;
+INSERT INTO t1 VALUES(1);
+--error ER_XAER_RMFAIL
+SET SESSION autocommit=1;
+SELECT @@autocommit;
+INSERT INTO t1 VALUES(1);
+XA END 'x';
+XA COMMIT 'x' ONE PHASE;
+DROP TABLE t1;
+SET SESSION autocommit=DEFAULT;
+
--echo End of 5.0 tests
# Wait till all disconnects are completed