summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-05-12 17:10:58 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2022-05-25 13:32:58 +0530
commit7fe474fe7e25cb503b585755c7e0a036e01e0df7 (patch)
tree1e4cf1eb14f9d164b8117fd0cd3c589eaf800bfa
parent7d3d3838c1b8af98a9704120b79c481a4113b862 (diff)
downloadmariadb-git-7fe474fe7e25cb503b585755c7e0a036e01e0df7.tar.gz
MDEV-25257 SEGV in fts_get_next_doc_id upon some INSERT
- InnoDB fails to create a fts cache while loading the innodb fts table which is stored in system tablespace. InnoDB should create the fts cache while loading FTS_DOC_ID column from system column.
-rw-r--r--mysql-test/suite/innodb_fts/r/fulltext.result14
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext.test16
-rw-r--r--storage/innobase/dict/dict0load.cc1
3 files changed, 31 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb_fts/r/fulltext.result b/mysql-test/suite/innodb_fts/r/fulltext.result
index abcdebca01d..7775a46e0d8 100644
--- a/mysql-test/suite/innodb_fts/r/fulltext.result
+++ b/mysql-test/suite/innodb_fts/r/fulltext.result
@@ -718,4 +718,18 @@ t1 CREATE TABLE `t1` (
FULLTEXT KEY `a_2` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
DROP TABLE t1;
+#
+# MDEV-25257 SEGV in fts_get_next_doc_id upon some INSERT
+#
+SET @save = @@global.innodb_file_per_table;
+SET @@global.innodb_file_per_table = 0;
+CREATE TABLE t1 (
+col_int INTEGER, col_text TEXT,
+col_int_g INTEGER GENERATED ALWAYS AS (col_int)
+) ENGINE = InnoDB ROW_FORMAT = Redundant ;
+ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ;
+ALTER TABLE t1 DROP KEY `ftidx` ;
+INSERT INTO t1 (col_int, col_text) VALUES ( 1255, NULL);
+DROP TABLE t1;
+SET @@global.innodb_file_per_table = @save;
# End of 10.3 tests
diff --git a/mysql-test/suite/innodb_fts/t/fulltext.test b/mysql-test/suite/innodb_fts/t/fulltext.test
index f3bcaaec5cc..4878a0bee3f 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext.test
@@ -741,4 +741,20 @@ ALTER TABLE t1 ADD FULLTEXT INDEX (a);
SHOW CREATE TABLE t1;
DROP TABLE t1;
+--echo #
+--echo # MDEV-25257 SEGV in fts_get_next_doc_id upon some INSERT
+--echo #
+SET @save = @@global.innodb_file_per_table;
+SET @@global.innodb_file_per_table = 0;
+
+CREATE TABLE t1 (
+ col_int INTEGER, col_text TEXT,
+ col_int_g INTEGER GENERATED ALWAYS AS (col_int)
+) ENGINE = InnoDB ROW_FORMAT = Redundant ;
+ALTER TABLE t1 ADD FULLTEXT KEY `ftidx` ( col_text ) ;
+ALTER TABLE t1 DROP KEY `ftidx` ;
+INSERT INTO t1 (col_int, col_text) VALUES ( 1255, NULL);
+DROP TABLE t1;
+SET @@global.innodb_file_per_table = @save;
+
--echo # End of 10.3 tests
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 386b99bcaad..dade0c5b19e 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -1851,6 +1851,7 @@ dict_load_columns(
the flag is set before the table is created. */
if (table->fts == NULL) {
table->fts = fts_create(table);
+ table->fts->cache = fts_cache_create(table);
fts_optimize_add_table(table);
}