summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorNikita Malyavin <nikitamalyavin@gmail.com>2021-10-07 17:02:26 +0300
committerNikita Malyavin <nikitamalyavin@gmail.com>2021-10-20 15:15:21 +0300
commitcaebe151c18a3415466cca88dbdacb8ec9597a29 (patch)
tree0c2fd1d2c43969b16e190cfe71700d1edb682d54 /mysql-test
parent1811fd51fbae9e6c1f06ce93faef2bf1279cd3b6 (diff)
downloadmariadb-git-caebe151c18a3415466cca88dbdacb8ec9597a29.tar.gz
MDEV-22445 Crash on HANDLER READ NEXT after XA PREPARE
The assertion is absolutely correct since no data access is possible after XA PREPARE. The check is added in mysql_ha_read.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/xa.result15
-rw-r--r--mysql-test/t/xa.test17
2 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/r/xa.result b/mysql-test/r/xa.result
index 4e4d7bc6048..f6bae2adac2 100644
--- a/mysql-test/r/xa.result
+++ b/mysql-test/r/xa.result
@@ -341,5 +341,20 @@ Message XAER_RMFAIL: The command cannot be executed when global transaction is i
xa commit 'foo';
drop table t1;
#
+# MDEV-22445 Crash on HANDLER READ NEXT after XA PREPARE
+#
+CREATE TABLE t (a INT KEY) ENGINE=InnoDB;
+HANDLER t OPEN AS t;
+XA START '0';
+SELECT * FROM t;
+a
+XA END '0';
+XA PREPARE '0';
+HANDLER t READ NEXT;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the PREPARED state
+# Cleanup
+XA COMMIT '0';
+DROP TABLE t;
+#
# End of 10.2 tests
#
diff --git a/mysql-test/t/xa.test b/mysql-test/t/xa.test
index b13d12d2019..176b8c3189b 100644
--- a/mysql-test/t/xa.test
+++ b/mysql-test/t/xa.test
@@ -486,5 +486,22 @@ xa commit 'foo';
drop table t1;
--echo #
+--echo # MDEV-22445 Crash on HANDLER READ NEXT after XA PREPARE
+--echo #
+
+CREATE TABLE t (a INT KEY) ENGINE=InnoDB;
+HANDLER t OPEN AS t;
+XA START '0';
+SELECT * FROM t;
+XA END '0';
+XA PREPARE '0';
+--error ER_XAER_RMFAIL
+HANDLER t READ NEXT;
+
+--echo # Cleanup
+XA COMMIT '0';
+DROP TABLE t;
+
+--echo #
--echo # End of 10.2 tests
--echo #