Skip to content

Commit 5b3f7c0

Browse files
committed
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.
1 parent 06442e3 commit 5b3f7c0

File tree

6 files changed

+270
-326
lines changed

6 files changed

+270
-326
lines changed

storage/innobase/fil/fil0fil.cc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2773,6 +2773,29 @@ fil_close_tablespace(
27732773
return(err);
27742774
}
27752775

2776+
/** Determine whether a table can be accessed in operations that are
2777+
not (necessarily) protected by meta-data locks.
2778+
(Rollback would generally be protected, but rollback of
2779+
FOREIGN KEY CASCADE/SET NULL is not protected by meta-data locks
2780+
but only by InnoDB table locks, which may be broken by
2781+
lock_remove_all_on_table().)
2782+
@param[in] table persistent table
2783+
checked @return whether the table is accessible */
2784+
UNIV_INTERN bool fil_table_accessible(const dict_table_t* table)
2785+
{
2786+
if (UNIV_UNLIKELY(!table->is_readable() || table->corrupted)) {
2787+
return(false);
2788+
}
2789+
2790+
if (fil_space_t* space = fil_space_acquire(table->space)) {
2791+
bool accessible = !space->is_stopping();
2792+
fil_space_release(space);
2793+
return(accessible);
2794+
} else {
2795+
return(false);
2796+
}
2797+
}
2798+
27762799
/** Delete a tablespace and associated .ibd file.
27772800
@param[in] id tablespace identifier
27782801
@param[in] drop_ahi whether to drop the adaptive hash index

0 commit comments

Comments
 (0)