From 77867c147b8a278977203ad33d7daff0587a112a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 12 May 2018 10:28:54 +0300 Subject: [PATCH] dict_create_index_tree_in_mem(): Remove dead code In InnoDB, CREATE TEMPORARY TABLE does not allow FULLTEXT INDEX. Replace a condition with a debug assertion, and add a test. --- mysql-test/suite/innodb_fts/r/basic.result | 7 +++++++ mysql-test/suite/innodb_fts/t/basic.test | 8 ++++++++ storage/innobase/dict/dict0crea.cc | 8 ++------ 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/innodb_fts/r/basic.result b/mysql-test/suite/innodb_fts/r/basic.result index ae23b93dc84..d96127fbc34 100644 --- a/mysql-test/suite/innodb_fts/r/basic.result +++ b/mysql-test/suite/innodb_fts/r/basic.result @@ -1,3 +1,10 @@ +CREATE TEMPORARY TABLE articles ( +id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, +title VARCHAR(200), +body TEXT, +FULLTEXT (title,body) +) ENGINE=InnoDB; +ERROR HY000: Cannot create FULLTEXT index on temporary InnoDB table CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), diff --git a/mysql-test/suite/innodb_fts/t/basic.test b/mysql-test/suite/innodb_fts/t/basic.test index 58f36be08a5..0c0920c5f16 100644 --- a/mysql-test/suite/innodb_fts/t/basic.test +++ b/mysql-test/suite/innodb_fts/t/basic.test @@ -3,6 +3,14 @@ -- source include/have_innodb.inc # Create FTS table +--error ER_INNODB_NO_FT_TEMP_TABLE +CREATE TEMPORARY TABLE articles ( + id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, + title VARCHAR(200), + body TEXT, + FULLTEXT (title,body) + ) ENGINE=InnoDB; + CREATE TABLE articles ( id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY, title VARCHAR(200), diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index c1ee4f3bc4e..a83ee896972 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -943,14 +943,10 @@ dict_create_index_tree_in_mem( const trx_t* trx) /*!< in: InnoDB transaction handle */ { mtr_t mtr; - ulint page_no = FIL_NULL; + ulint page_no; ut_ad(mutex_own(&dict_sys->mutex)); - - if (index->type == DICT_FTS) { - /* FTS index does not need an index tree */ - return(DB_SUCCESS); - } + ut_ad(!(index->type & DICT_FTS)); mtr_start(&mtr); mtr_set_log_mode(&mtr, MTR_LOG_NO_REDO);