MDEV-30363 InnoDB: Failing assertion: trx->error_state == DB_SUCCESS in que_run_threads

Problem:
=========
- During truncation of a fulltext table, InnoDB does create the
table and does insert the default config fts values in fulltext
common config table using create table transaction.

- Before committing the create table transaction, InnoDB does update
the dictionary by loading the stopword into fts cache
and write the stopword configuration into fulltext common
config table by creating a separate transaction. This leads to
lock wait timeout error and rollbacks the transaction.

- But truncate table holds dict_sys.lock and rollback also
tries to acquire dict_sys.lock. This leads to assertion during
rollback.

Solution:
=========
ha_innobase::truncate(): Commit the create table transaction
before updating the dictionary after create table.
This commit is contained in:
Thirunarayanan Balathandayuthapani 2025-06-11 20:47:43 +05:30
parent 888663ce12
commit a4b0301b91
3 changed files with 26 additions and 1 deletions

View File

@ -993,3 +993,15 @@ FTS_DOC_ID f1 f2
4294967298 txt bbb
100000000000 aaa bbb
DROP TABLE t1;
#
# MDEV-30363 Failing assertion: trx->error_state == DB_SUCCESS
# in que_run_threads
#
CREATE TABLE server_stopword (value VARCHAR(1))engine=innodb;
SET GLOBAL innodb_ft_server_stopword_table='test/server_stopword';
CREATE TABLE t (t VARCHAR(1) COLLATE utf8_unicode_ci,
FULLTEXT (t))engine=innodb;
TRUNCATE TABLE t;
DROP TABLE t;
DROP TABLE server_stopword;
SET GLOBAL innodb_ft_server_stopword_table= default;

View File

@ -967,3 +967,16 @@ CREATE FULLTEXT INDEX i ON t1 (f2);
SELECT * FROM t1 WHERE match(f2) against("bbb");
# Cleanup
DROP TABLE t1;
--echo #
--echo # MDEV-30363 Failing assertion: trx->error_state == DB_SUCCESS
--echo # in que_run_threads
--echo #
CREATE TABLE server_stopword (value VARCHAR(1))engine=innodb;
SET GLOBAL innodb_ft_server_stopword_table='test/server_stopword';
CREATE TABLE t (t VARCHAR(1) COLLATE utf8_unicode_ci,
FULLTEXT (t))engine=innodb;
TRUNCATE TABLE t;
DROP TABLE t;
DROP TABLE server_stopword;
SET GLOBAL innodb_ft_server_stopword_table= default;

View File

@ -14088,10 +14088,10 @@ int ha_innobase::truncate()
trx);
if (!err)
{
trx->commit(deleted);
m_prebuilt->table->acquire();
create_table_info_t::create_table_update_dict(m_prebuilt->table,
m_user_thd, info, *table);
trx->commit(deleted);
}
else
{