From 661daf063608d7cbc9f389cd3376934038039c3b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 20 Jan 2025 18:10:57 +0100 Subject: [PATCH] MDEV-31298 Assertion `!check_foreigns' failed in trx_mod_table_time_t* trx_t::check_bulk_buffer(dict_table_t*), Assertion `table->skip_alter_undo || !check_unique_secondary' failed in trx_t::check_bulk_buffer unlike CREATE TABLE, CREATE SEQUENCE always causes an implicit commit, even for temporary sequences. --- mysql-test/suite/sql_sequence/temporary.result | 15 +++++++++++++++ mysql-test/suite/sql_sequence/temporary.test | 18 ++++++++++++++++++ sql/sql_parse.cc | 1 - 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/sql_sequence/temporary.result b/mysql-test/suite/sql_sequence/temporary.result index b5c70fd3a50..78ad40c2582 100644 --- a/mysql-test/suite/sql_sequence/temporary.result +++ b/mysql-test/suite/sql_sequence/temporary.result @@ -41,3 +41,18 @@ select nextval(s1); nextval(s1) 2 drop temporary sequence s1; +# End of 10.6 test +# +# MDEV-31298 Assertion `!check_foreigns' failed in trx_mod_table_time_t* trx_t::check_bulk_buffer(dict_table_t*), Assertion `table->skip_alter_undo || !check_unique_secondary' failed in trx_t::check_bulk_buffer +# +set foreign_key_checks=0,unique_checks=0; +create table t1 (c1 char,index (c1)) engine=innodb; +xa start 'a'; +insert into t1 values(); +set foreign_key_checks=1,unique_checks=1; +create temporary sequence f engine=innodb; +ERROR XAE07: XAER_RMFAIL: The command cannot be executed when global transaction is in the ACTIVE state +xa end 'a'; +xa rollback 'a'; +drop table t1; +# End of 10.11 test diff --git a/mysql-test/suite/sql_sequence/temporary.test b/mysql-test/suite/sql_sequence/temporary.test index e57dc693304..cdb50d9ee20 100644 --- a/mysql-test/suite/sql_sequence/temporary.test +++ b/mysql-test/suite/sql_sequence/temporary.test @@ -45,3 +45,21 @@ select nextval(s1); select nextval(s1); drop temporary sequence s1; --enable_ps2_protocol + +--echo # End of 10.6 test + +--echo # +--echo # MDEV-31298 Assertion `!check_foreigns' failed in trx_mod_table_time_t* trx_t::check_bulk_buffer(dict_table_t*), Assertion `table->skip_alter_undo || !check_unique_secondary' failed in trx_t::check_bulk_buffer +--echo # +set foreign_key_checks=0,unique_checks=0; +create table t1 (c1 char,index (c1)) engine=innodb; +xa start 'a'; +insert into t1 values(); +set foreign_key_checks=1,unique_checks=1; +--error ER_XAER_RMFAIL +create temporary sequence f engine=innodb; +xa end 'a'; +xa rollback 'a'; +drop table t1; + +--echo # End of 10.11 test diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 472932cf80c..2b1fe1d9fdf 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -441,7 +441,6 @@ bool stmt_causes_implicit_commit(THD *thd, uint mask) case SQLCOM_DROP_TABLE: case SQLCOM_DROP_SEQUENCE: case SQLCOM_CREATE_TABLE: - case SQLCOM_CREATE_SEQUENCE: /* If CREATE TABLE of non-temporary table and the table is not part if a BEGIN GTID ... COMMIT group, do a implicit commit.