mariadb/mysql-test/suite/innodb_fts/t/concurrent_insert.test
Thirunarayanan Balathandayuthapani 1fd7d3a9ad MDEV-25581 Allow user thread to do InnoDB fts cache sync
Problem:
========
  InnoDB FTS requesting the fts sync of the table once the fts
cache size reaches 1/10 of innodb_ft_cache_size. But fts_sync()
releases cache lock when writing the word. By doing this, InnoDB
insert thread increases the innodb fts cache memory and
SYNC operation will take more time to complete.

Solution:
=========
  Remove the fts sync operation(FTS_MSG_SYNC_TABLE) from
the fts optimize background thread. Instead of that,
allow user thread to sync the InnoDB fts cache when
the cache size exceeds 512 kb. User thread holds
cache lock while doing cache syncing, it make sure that
other threads doesn't add the docs into the cache.

Removed FTS_MSG_SYNC_TABLE and its related function
because we do remove the FTS_MSG_SYNC_TABLE message
itself.

Removed fts_sync_index_check() and all related
function because other threads doesn't add while
cache operation going on.
2022-06-10 13:39:07 +05:30

52 lines
1.4 KiB
Text

--source include/have_innodb.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
CREATE TABLE t1(a VARCHAR(5),FULLTEXT KEY(a)) ENGINE=InnoDB;
SET DEBUG_SYNC = 'get_next_FTS_DOC_ID SIGNAL prepared WAIT_FOR race';
--send
REPLACE INTO t1(a) values('aaa');
connect(dml, localhost, root, ,);
SET DEBUG_SYNC = 'now WAIT_FOR prepared';
REPLACE INTO t1(a) VALUES('aaa');
SET DEBUG_SYNC = 'now SIGNAL race';
disconnect dml;
connection default;
reap;
SET DEBUG_SYNC = 'RESET';
DROP TABLE t1;
--echo #
--echo # MDEV-19529 InnoDB hang on DROP FULLTEXT INDEX
--echo #
CREATE TABLE t1(f1 CHAR(100), FULLTEXT(f1))ENGINE=InnoDB;
INSERT INTO t1 VALUES('test');
CREATE TABLE t2 (f1 char(100), FULLTEXT idx1(f1))ENGINE=InnoDB;
INSERT INTO t2 VALUES('mariadb');
connection default;
SET @saved_dbug = @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug ='+d,fts_instrument_sync_request,ib_optimize_wq_hang';
SET DEBUG_SYNC= 'fts_sync_end
SIGNAL drop_index_start WAIT_FOR sync_op';
send INSERT INTO t1 VALUES('Keyword');
connect(con1,localhost,root,,,);
SET DEBUG_SYNC='now WAIT_FOR drop_index_start';
SET DEBUG_SYNC= 'norebuild_fts_drop SIGNAL sync_op WAIT_FOR fts_drop_index';
send ALTER TABLE t2 drop index idx1;
connection default;
reap;
set DEBUG_SYNC= 'now SIGNAL fts_drop_index';
connection con1;
reap;
drop table t1, t2;
connection default;
set DEBUG_SYNC=RESET;
SET @@GLOBAL.debug_dbug = @saved_dbug;