From 0024524d542bffcadc3359543511c9b62d4742d7 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 29 Apr 2021 12:31:06 +0530 Subject: [PATCH] MDEV-25536 InnoDB: Failing assertion: sym_node->table != NULL in pars_retrieve_table_def InnoDB tries to fetch the deleted doc ids for discarded tablespace. In i_s_fts_deleted_generic_fill(), InnoDB needs to check whether the table is discarded or not before fetching deleted doc ids. --- mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result | 10 ++++++++++ mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test | 10 ++++++++++ storage/innobase/handler/i_s.cc | 3 ++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result index e039b7e77d9..8ec0157728c 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result +++ b/mysql-test/suite/innodb_fts/r/innodb_fts_misc_1.result @@ -962,3 +962,13 @@ UPDATE t1 SET f6='cascade'; ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_3` FOREIGN KEY (`f5`) REFERENCES `t1` (`f6`) ON UPDATE SET NULL) DROP TABLE t1; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +# +# MDEV-25536 sym_node->table != NULL in pars_retrieve_table_def +# +CREATE TABLE t1 (f1 TEXT,FULLTEXT (f1)) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SET GLOBAL innodb_ft_aux_table='test/t1'; +SELECT * FROM information_schema.innodb_ft_deleted; +DOC_ID +DROP TABLE t1; +SET GLOBAL innodb_ft_aux_table=DEFAULT; diff --git a/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test index 46b65590298..adc10886d66 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test +++ b/mysql-test/suite/innodb_fts/t/innodb_fts_misc_1.test @@ -932,3 +932,13 @@ UPDATE t1 SET f6='cascade'; DROP TABLE t1; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; + +--echo # +--echo # MDEV-25536 sym_node->table != NULL in pars_retrieve_table_def +--echo # +CREATE TABLE t1 (f1 TEXT,FULLTEXT (f1)) ENGINE=InnoDB; +ALTER TABLE t1 DISCARD TABLESPACE; +SET GLOBAL innodb_ft_aux_table='test/t1'; +SELECT * FROM information_schema.innodb_ft_deleted; +DROP TABLE t1; +SET GLOBAL innodb_ft_aux_table=DEFAULT; diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 003760f80b1..bf6717de5ee 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -2901,7 +2901,8 @@ i_s_fts_deleted_generic_fill( if (!user_table) { rw_lock_s_unlock(&dict_operation_lock); DBUG_RETURN(0); - } else if (!dict_table_has_fts_index(user_table)) { + } else if (!dict_table_has_fts_index(user_table) + || !user_table->is_readable()) { dict_table_close(user_table, FALSE, FALSE); rw_lock_s_unlock(&dict_operation_lock); DBUG_RETURN(0);