Commit 1a2308d3 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-26865: Add test case and instrumentation

Based on mysql/mysql-server@bc9c46bf2894673d0df17cd0ee872d0d99663121
but without sleeps.

The test was verified to hit the debug assertion if the change to
fts_add_doc_by_id() in commit 2d98b967
was reverted.
parent 2d98b967
#
# Bug#32831765 SERVER HITS OOM CONDITION WHEN LOADING TWO
# INNODB TABLES WITH FTS INDEXES
#
create table t1 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text,
`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07`
text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text,
`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18`
text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text,
`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29`
text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY
(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY
(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY
(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY
(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY
(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY
(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY
(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY
(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY
(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY
(`col29`), FULLTEXT KEY (`col30`)) engine=innodb;
create table t2 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text,
`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07`
text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text,
`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18`
text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text,
`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29`
text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY
(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY
(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY
(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY
(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY
(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY
(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY
(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY
(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY
(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY
(`col29`), FULLTEXT KEY (`col30`)) engine=innodb;
create table t3 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text,
`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07`
text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text,
`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18`
text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text,
`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29`
text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY
(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY
(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY
(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY
(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY
(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY
(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY
(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY
(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY
(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY
(`col29`), FULLTEXT KEY (`col30`)) engine=innodb;
create table t4 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text,
`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07`
text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text,
`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18`
text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text,
`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29`
text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY
(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY
(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY
(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY
(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY
(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY
(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY
(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY
(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY
(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY
(`col29`), FULLTEXT KEY (`col30`)) engine=innodb;
#create procedure to inset into the table.
CREATE PROCEDURE `proc_insert`(IN tab_name VARCHAR(40))
BEGIN
DECLARE i INT DEFAULT 1;
SET @insert_tbl =CONCAT('INSERT INTO ', tab_name, '( `col01`, `col02`,
`col03`, `col04`, `col05`, `col06`, `col07`, `col08`, `col09`, `col10`,
`col11`, `col12`, `col13`, `col14`, `col15`, `col16`, `col17`, `col18`,
`col19`, `col20`, `col21`, `col22`, `col23`, `col24`, `col25`, `col26`,
`col27`, `col28`, `col29`, `col30`)
VALUES ( MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()))');
PREPARE ins_stmt FROM @insert_tbl;
while (i <= 2000) DO
EXECUTE ins_stmt;
SET i = i + 1;
END WHILE;
DEALLOCATE PREPARE ins_stmt;
END |
SET @save_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,fts_optimize_wq_count_check";
connect con1,localhost,root,,;
call proc_insert('t1');
connect con2,localhost,root,,;
call proc_insert('t1');
connect con3,localhost,root,,;
call proc_insert('t2');
connect con4,localhost,root,,;
call proc_insert('t2');
connect con5,localhost,root,,;
call proc_insert('t3');
connect con6,localhost,root,,;
call proc_insert('t3');
connect con7,localhost,root,,;
call proc_insert('t4');
connection default;
call proc_insert('t4');
SET GLOBAL debug_dbug= @save_dbug;
connection con1;
disconnect con1;
connection con2;
disconnect con2;
connection con3;
disconnect con3;
connection con4;
disconnect con4;
connection con5;
disconnect con5;
connection con6;
disconnect con6;
connection con7;
disconnect con7;
connection default;
DROP TABLE t1,t2,t3,t4;
DROP PROCEDURE proc_insert;
--source include/have_innodb.inc
--source include/have_debug.inc
--source include/big_test.inc
--echo #
--echo # Bug#32831765 SERVER HITS OOM CONDITION WHEN LOADING TWO
--echo # INNODB TABLES WITH FTS INDEXES
--echo #
create table t1 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text,
`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07`
text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text,
`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18`
text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text,
`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29`
text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY
(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY
(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY
(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY
(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY
(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY
(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY
(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY
(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY
(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY
(`col29`), FULLTEXT KEY (`col30`)) engine=innodb;
create table t2 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text,
`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07`
text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text,
`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18`
text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text,
`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29`
text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY
(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY
(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY
(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY
(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY
(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY
(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY
(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY
(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY
(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY
(`col29`), FULLTEXT KEY (`col30`)) engine=innodb;
create table t3 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text,
`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07`
text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text,
`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18`
text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text,
`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29`
text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY
(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY
(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY
(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY
(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY
(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY
(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY
(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY
(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY
(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY
(`col29`), FULLTEXT KEY (`col30`)) engine=innodb;
create table t4 ( `id` int unsigned NOT NULL AUTO_INCREMENT, `col01` text,
`col02` text, `col03` text, `col04` text, `col05` text, `col06` text, `col07`
text, `col08` text, `col09` text, `col10` text, `col11` text, `col12` text,
`col13` text, `col14` text, `col15` text, `col16` text, `col17` text, `col18`
text, `col19` text, `col20` text, `col21` text, `col22` text, `col23` text,
`col24` text, `col25` text, `col26` text, `col27` text, `col28` text, `col29`
text, `col30` text, PRIMARY KEY (`id`), FULLTEXT KEY (`col01`), FULLTEXT KEY
(`col02`), FULLTEXT KEY (`col03`), FULLTEXT KEY (`col04`), FULLTEXT KEY
(`col05`), FULLTEXT KEY (`col06`), FULLTEXT KEY (`col07`), FULLTEXT KEY
(`col08`), FULLTEXT KEY (`col09`), FULLTEXT KEY (`col10`), FULLTEXT KEY
(`col11`), FULLTEXT KEY (`col12`), FULLTEXT KEY (`col13`), FULLTEXT KEY
(`col14`), FULLTEXT KEY (`col15`), FULLTEXT KEY (`col16`), FULLTEXT KEY
(`col17`), FULLTEXT KEY (`col18`), FULLTEXT KEY (`col19`), FULLTEXT KEY
(`col20`), FULLTEXT KEY (`col21`), FULLTEXT KEY (`col22`), FULLTEXT KEY
(`col23`), FULLTEXT KEY (`col24`), FULLTEXT KEY (`col25`), FULLTEXT KEY
(`col26`), FULLTEXT KEY (`col27`), FULLTEXT KEY (`col28`), FULLTEXT KEY
(`col29`), FULLTEXT KEY (`col30`)) engine=innodb;
delimiter |;
--echo #create procedure to inset into the table.
CREATE PROCEDURE `proc_insert`(IN tab_name VARCHAR(40))
BEGIN
DECLARE i INT DEFAULT 1;
SET @insert_tbl =CONCAT('INSERT INTO ', tab_name, '( `col01`, `col02`,
`col03`, `col04`, `col05`, `col06`, `col07`, `col08`, `col09`, `col10`,
`col11`, `col12`, `col13`, `col14`, `col15`, `col16`, `col17`, `col18`,
`col19`, `col20`, `col21`, `col22`, `col23`, `col24`, `col25`, `col26`,
`col27`, `col28`, `col29`, `col30`)
VALUES ( MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()), MD5(RAND()),
MD5(RAND()))');
PREPARE ins_stmt FROM @insert_tbl;
while (i <= 2000) DO
EXECUTE ins_stmt;
SET i = i + 1;
END WHILE;
DEALLOCATE PREPARE ins_stmt;
END |
delimiter ;|
# Ensure that the number of SYNC requests will not exceed 1000.
SET @save_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL debug_dbug="+d,fts_optimize_wq_count_check";
connect (con1,localhost,root,,);
send call proc_insert('t1');
connect (con2,localhost,root,,);
send call proc_insert('t1');
connect (con3,localhost,root,,);
send call proc_insert('t2');
connect (con4,localhost,root,,);
send call proc_insert('t2');
connect (con5,localhost,root,,);
send call proc_insert('t3');
connect (con6,localhost,root,,);
send call proc_insert('t3');
connect (con7,localhost,root,,);
send call proc_insert('t4');
connection default;
call proc_insert('t4');
SET GLOBAL debug_dbug= @save_dbug;
connection con1;
reap;
disconnect con1;
connection con2;
reap;
disconnect con2;
connection con3;
reap;
disconnect con3;
connection con4;
reap;
disconnect con4;
connection con5;
reap;
disconnect con5;
connection con6;
reap;
disconnect con6;
connection con7;
reap;
disconnect con7;
connection default;
DROP TABLE t1,t2,t3,t4;
DROP PROCEDURE proc_insert;
...@@ -2641,6 +2641,9 @@ fts_optimize_request_sync_table( ...@@ -2641,6 +2641,9 @@ fts_optimize_request_sync_table(
ib_wqueue_add(fts_optimize_wq, msg, msg->heap, true); ib_wqueue_add(fts_optimize_wq, msg, msg->heap, true);
DBUG_EXECUTE_IF("fts_optimize_wq_count_check",
DBUG_ASSERT(fts_optimize_wq->length <= 1000););
mutex_exit(&fts_optimize_wq->mutex); mutex_exit(&fts_optimize_wq->mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment