summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/main/xa.result13
-rw-r--r--mysql-test/main/xa.test26
-rw-r--r--sql/sql_sequence.cc6
3 files changed, 43 insertions, 2 deletions
diff --git a/mysql-test/main/xa.result b/mysql-test/main/xa.result
index f77c0afdec5..f37a3c36531 100644
--- a/mysql-test/main/xa.result
+++ b/mysql-test/main/xa.result
@@ -345,3 +345,16 @@ connection default;
XA END 'xid1';
XA ROLLBACK 'xid1';
DROP TABLE t1, t2, t3;
+XA BEGIN 'xid';
+CREATE TEMPORARY SEQUENCE s;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
+XA END 'xid';
+XA ROLLBACK 'xid';
+XA BEGIN 'xid';
+CREATE SEQUENCE s;
+ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state
+XA END 'xid';
+XA ROLLBACK 'xid';
+#
+# End of 10.3 tests
+#
diff --git a/mysql-test/main/xa.test b/mysql-test/main/xa.test
index 176ef6aa760..ce8f3834b03 100644
--- a/mysql-test/main/xa.test
+++ b/mysql-test/main/xa.test
@@ -478,3 +478,29 @@ DROP TABLE t1, t2, t3;
--source include/wait_until_count_sessions.inc
+#
+# MDEV-22002 Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())'
+# failed upon CREATE TEMPORARY SEQUENCE under XA
+#
+
+XA BEGIN 'xid';
+
+--error ER_XAER_RMFAIL
+CREATE TEMPORARY SEQUENCE s;
+
+XA END 'xid';
+
+XA ROLLBACK 'xid';
+
+XA BEGIN 'xid';
+
+--error ER_XAER_RMFAIL
+CREATE SEQUENCE s;
+
+XA END 'xid';
+
+XA ROLLBACK 'xid';
+
+--echo #
+--echo # End of 10.3 tests
+--echo #
diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc
index b69b52505f4..96c1cd19433 100644
--- a/sql/sql_sequence.cc
+++ b/sql/sql_sequence.cc
@@ -355,8 +355,10 @@ bool sequence_insert(THD *thd, LEX *lex, TABLE_LIST *org_table_list)
seq->reserved_until= seq->start;
error= seq->write_initial_sequence(table);
- trans_commit_stmt(thd);
- trans_commit_implicit(thd);
+ if (trans_commit_stmt(thd))
+ error= 1;
+ if (trans_commit_implicit(thd))
+ error= 1;
if (!temporary_table)
{