summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-03-10 16:46:42 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-03-10 16:50:10 +0530
commitcc9c303a450bf9cbb9bda51638d0c435fe755336 (patch)
treee898183482ad0e21a9e2dd61d2ab6f7aa32bbf1e
parent75f781f0d27d73dce4c7570e5b94b9482903c907 (diff)
downloadmariadb-git-cc9c303a450bf9cbb9bda51638d0c435fe755336.tar.gz
MDEV-25070 SIGSEGV in fts_create_in_mem_aux_table
InnoDB set the space in dict_table_t as NULL when table is discarded. So InnoDB shouldn't use the space present in table to detect whether the given tablespace is temporary tablespace.
-rw-r--r--mysql-test/suite/innodb_fts/r/fulltext.result16
-rw-r--r--mysql-test/suite/innodb_fts/t/fulltext.test9
-rw-r--r--storage/innobase/fts/fts0fts.cc2
3 files changed, 26 insertions, 1 deletions
diff --git a/mysql-test/suite/innodb_fts/r/fulltext.result b/mysql-test/suite/innodb_fts/r/fulltext.result
index 0e30dd0be05..f41b938604d 100644
--- a/mysql-test/suite/innodb_fts/r/fulltext.result
+++ b/mysql-test/suite/innodb_fts/r/fulltext.result
@@ -689,3 +689,19 @@ FTS_DOC_ID t
2 foo bar
3 foo
DROP TABLE t;
+#
+# MDEV-25070 SIGSEGV in fts_create_in_mem_aux_table
+#
+CREATE TABLE t1 (a CHAR, FULLTEXT KEY(a)) ENGINE=InnoDB;
+ALTER TABLE t1 DISCARD TABLESPACE;
+ALTER TABLE t1 ADD FULLTEXT INDEX (a);
+Warnings:
+Warning 1814 Tablespace has been discarded for table `t1`
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `a` char(1) DEFAULT NULL,
+ FULLTEXT KEY `a` (`a`),
+ FULLTEXT KEY `a_2` (`a`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb_fts/t/fulltext.test b/mysql-test/suite/innodb_fts/t/fulltext.test
index 663b202265b..560ee8f96f2 100644
--- a/mysql-test/suite/innodb_fts/t/fulltext.test
+++ b/mysql-test/suite/innodb_fts/t/fulltext.test
@@ -717,3 +717,12 @@ while ($N)
}
DROP TABLE t;
+
+--echo #
+--echo # MDEV-25070 SIGSEGV in fts_create_in_mem_aux_table
+--echo #
+CREATE TABLE t1 (a CHAR, FULLTEXT KEY(a)) ENGINE=InnoDB;
+ALTER TABLE t1 DISCARD TABLESPACE;
+ALTER TABLE t1 ADD FULLTEXT INDEX (a);
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 859ec5051f2..cf76e3c83cd 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -1730,7 +1730,7 @@ fts_create_in_mem_aux_table(
dict_table_t* new_table = dict_mem_table_create(
aux_table_name, NULL, n_cols, 0, table->flags,
table->space_id == TRX_SYS_SPACE
- ? 0 : table->space->purpose == FIL_TYPE_TEMPORARY
+ ? 0 : table->space_id == SRV_TMP_SPACE_ID
? DICT_TF2_TEMPORARY : DICT_TF2_USE_FILE_PER_TABLE);
if (DICT_TF_HAS_DATA_DIR(table->flags)) {