summaryrefslogtreecommitdiff
path: root/storage/innobase/fil/fil0fil.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-05-09 14:08:49 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-05-10 07:56:55 +0300
commit5b3f7c0c33e74426d5d22db1ac159ddead79cbc1 (patch)
tree4ad8610a5cb6ae8424ff7b27d83aec9e5daf89bd /storage/innobase/fil/fil0fil.cc
parent06442e3e9f7819a982eb7a4dc865be02c556ab06 (diff)
downloadmariadb-git-5b3f7c0c33e74426d5d22db1ac159ddead79cbc1.tar.gz
MDEV-18220: Remove some redundant data structures
fts_state_t, fts_slot_t::state: Remove. Replaced by fts_slot_t::running and fts_slot_t::table_id as follows. FTS_STATE_SUSPENDED: Removed (unused). FTS_STATE_EMPTY: Removed. table_id=0 will denote empty slots. FTS_STATE_RUNNING: Equivalent to running=true. FTS_STATE_LOADED, FTS_STATE_DONE: Equivalent to running=false. fts_slot_t::table: Remove. Tables will be identified by table_id. After opening a table, we will check fil_table_accessible() before accessing the data. fts_optimize_new_table(), fts_optimize_del_table(), fts_optimize_how_many(), fts_is_sync_needed(): Remove the parameter tables, and use the static variable fts_slots (which was introduced in MariaDB 10.2) instead.
Diffstat (limited to 'storage/innobase/fil/fil0fil.cc')
-rw-r--r--storage/innobase/fil/fil0fil.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 31178b67a06..e3d32df6c2b 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -2773,6 +2773,29 @@ fil_close_tablespace(
return(err);
}
+/** Determine whether a table can be accessed in operations that are
+not (necessarily) protected by meta-data locks.
+(Rollback would generally be protected, but rollback of
+FOREIGN KEY CASCADE/SET NULL is not protected by meta-data locks
+but only by InnoDB table locks, which may be broken by
+lock_remove_all_on_table().)
+@param[in] table persistent table
+checked @return whether the table is accessible */
+UNIV_INTERN bool fil_table_accessible(const dict_table_t* table)
+{
+ if (UNIV_UNLIKELY(!table->is_readable() || table->corrupted)) {
+ return(false);
+ }
+
+ if (fil_space_t* space = fil_space_acquire(table->space)) {
+ bool accessible = !space->is_stopping();
+ fil_space_release(space);
+ return(accessible);
+ } else {
+ return(false);
+ }
+}
+
/** Delete a tablespace and associated .ibd file.
@param[in] id tablespace identifier
@param[in] drop_ahi whether to drop the adaptive hash index