Details
-
Bug
-
Status: In Progress (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.6, 10.11, 11.4, 11.8
-
None
Description
Following test case proves that InnoDB fulltext optimization can happen simultaneously
on the same table in two different connections. Test case:
--source include/have_innodb.inc
|
CREATE TABLE t1 (pk INT KEY,c TEXT) ENGINE=InnoDB;
|
INSERT INTO t1 VALUES(1,"thiru"),(2,"mariadb"),(3,"mysql"),(4,"mysqll");
|
ALTER TABLE t1 ADD FULLTEXT KEY text (c);
|
DELETE FROM t1 WHERE pk > 3;
|
SET GLOBAL INNODB_OPTIMIZE_FULLTEXT_ONLY=1;
|
SET DEBUG_SYNC="set_last_optimize_word SIGNAL con1_begin WAIT_FOR con1_finish";
|
send OPTIMIZE TABLE t1;
|
 |
connect(con1,localhost,root,,,);
|
SET DEBUG_SYNC="now WAIT_FOR con1_begin";
|
SET GLOBAL INNODB_OPTIMIZE_FULLTEXT_ONLY=1;
|
OPTIMIZE TABLE t1;
|
set DEBUG_SYNC="now SIGNAL con1_finish";
|
In error log: 2nd optimize table throw
2025-11-28 0:15:32 5 [ERROR] InnoDB: (Lock wait timeout) during optimize, when deleting a word from the FTS index
|
It is happening because 1st optimize table holds the record lock.
Issues:
1) There is no use in allowing multiple fulltext optimization on the same table.
2) SQL parser fail to set thr->lock_state as QUE_THR_LOCK_ROW when it encounters DB_LOCK_WAIT while locking the record.
3) optimize table transaction doesn't have thd on it. Even though it triggers via user_thd. Both have to be fixed in existing version.