diff options
Diffstat (limited to 'storage/innobase/row/row0mysql.cc')
-rw-r--r-- | storage/innobase/row/row0mysql.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 0aa05a702f3..a437c8d5ff1 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2000, 2018, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, 2019, MariaDB Corporation. +Copyright (c) 2015, 2020, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -3056,6 +3056,16 @@ row_discard_tablespace_for_mysql( err = DB_ERROR; } else { + bool fts_exist = (dict_table_has_fts_index(table) + || DICT_TF2_FLAG_IS_SET( + table, DICT_TF2_FTS_HAS_DOC_ID)); + + if (fts_exist) { + row_mysql_unlock_data_dictionary(trx); + fts_optimize_remove_table(table); + row_mysql_lock_data_dictionary(trx); + } + /* Do foreign key constraint checks. */ err = row_discard_tablespace_foreign_key_checks(trx, table); @@ -3063,6 +3073,10 @@ row_discard_tablespace_for_mysql( if (err == DB_SUCCESS) { err = row_discard_tablespace(trx, table); } + + if (fts_exist && err != DB_SUCCESS) { + fts_optimize_add_table(table); + } } return(row_discard_tablespace_end(trx, table, err)); |