-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-19445 heap-use-after-free related to innodb_ft_aux_table
Try to fix the race conditions between SET GLOBAL innodb_ft_aux_table = ...; and access to the INFORMATION_SCHEMA tables that depend on this variable. innodb_ft_aux_table: Replaces fts_internal_tbl_name,fts_internal_tbl_name2. Just store the user-specified parameter as is. innodb_ft_aux_table_id: The table_id corresponding to SET GLOBAL innodb_ft_aux_table, or 0 if the table does not exist or does not contain FULLTEXT INDEX. If the table is renamed later, the INFORMATION_SCHEMA tables will continue to refer to the table. If the table is dropped or rebuilt, the INFORMATION_SCHEMA tables will not find the table.
- Loading branch information
Showing
14 changed files
with
341 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
CREATE TABLE t1 (v VARCHAR(100), FULLTEXT INDEX (v)) ENGINE=InnoDB; | ||
insert into t1 VALUES('First record'),('Second record'),('Third record'); | ||
SET @save_ft_aux_table = @@GLOBAL.innodb_ft_aux_table; | ||
SET GLOBAL innodb_ft_aux_table = 'test/t0'; | ||
ERROR 42000: Variable 'innodb_ft_aux_table' can't be set to the value of 'test/t0' | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD; | ||
value | ||
a | ||
about | ||
an | ||
are | ||
as | ||
at | ||
be | ||
by | ||
com | ||
de | ||
en | ||
for | ||
from | ||
how | ||
i | ||
in | ||
is | ||
it | ||
la | ||
of | ||
on | ||
or | ||
that | ||
the | ||
this | ||
to | ||
was | ||
what | ||
when | ||
where | ||
who | ||
will | ||
with | ||
und | ||
the | ||
www | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; | ||
DOC_ID | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; | ||
DOC_ID | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; | ||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; | ||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; | ||
KEY VALUE | ||
SET GLOBAL innodb_ft_aux_table = 'test/t1'; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; | ||
DOC_ID | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; | ||
DOC_ID | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; | ||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION | ||
first 1 1 1 1 0 | ||
record 1 3 3 1 6 | ||
record 1 3 3 2 7 | ||
record 1 3 3 3 6 | ||
second 2 2 1 2 0 | ||
third 3 3 1 3 0 | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; | ||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; | ||
KEY VALUE | ||
optimize_checkpoint_limit 180 | ||
synced_doc_id 0 | ||
stopword_table_name | ||
use_stopword 1 | ||
SELECT @@GLOBAL.innodb_ft_aux_table; | ||
@@GLOBAL.innodb_ft_aux_table | ||
test/t1 | ||
RENAME TABLE t1 TO t2; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; | ||
DOC_ID | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; | ||
DOC_ID | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; | ||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION | ||
first 1 1 1 1 0 | ||
record 1 3 3 1 6 | ||
record 1 3 3 2 7 | ||
record 1 3 3 3 6 | ||
second 2 2 1 2 0 | ||
third 3 3 1 3 0 | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; | ||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; | ||
KEY VALUE | ||
optimize_checkpoint_limit 180 | ||
synced_doc_id 0 | ||
stopword_table_name | ||
use_stopword 1 | ||
SELECT @@GLOBAL.innodb_ft_aux_table; | ||
@@GLOBAL.innodb_ft_aux_table | ||
test/t1 | ||
DROP TABLE t2; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; | ||
DOC_ID | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; | ||
DOC_ID | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; | ||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; | ||
WORD FIRST_DOC_ID LAST_DOC_ID DOC_COUNT DOC_ID POSITION | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; | ||
KEY VALUE | ||
SELECT @@GLOBAL.innodb_ft_aux_table; | ||
@@GLOBAL.innodb_ft_aux_table | ||
test/t1 | ||
SET GLOBAL innodb_ft_aux_table = @save_ft_aux_table; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--innodb_ft_default_stopword | ||
--innodb_ft_deleted | ||
--innodb_ft_being_deleted | ||
--innodb_ft_index_cache | ||
--innodb_ft_index_table | ||
--innodb_ft_config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
--source include/have_innodb.inc | ||
|
||
CREATE TABLE t1 (v VARCHAR(100), FULLTEXT INDEX (v)) ENGINE=InnoDB; | ||
|
||
insert into t1 VALUES('First record'),('Second record'),('Third record'); | ||
|
||
SET @save_ft_aux_table = @@GLOBAL.innodb_ft_aux_table; | ||
|
||
connect (con1,localhost,root,,); | ||
--error ER_WRONG_VALUE_FOR_VAR | ||
SET GLOBAL innodb_ft_aux_table = 'test/t0'; | ||
connection default; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DEFAULT_STOPWORD; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; | ||
connection con1; | ||
SET GLOBAL innodb_ft_aux_table = 'test/t1'; | ||
disconnect con1; | ||
connection default; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; | ||
SELECT @@GLOBAL.innodb_ft_aux_table; | ||
RENAME TABLE t1 TO t2; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; | ||
SELECT @@GLOBAL.innodb_ft_aux_table; | ||
DROP TABLE t2; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_DELETED; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_BEING_DELETED; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; | ||
SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; | ||
SELECT @@GLOBAL.innodb_ft_aux_table; | ||
SET GLOBAL innodb_ft_aux_table = @save_ft_aux_table; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.