MDEV-21175 follow-up: Remove redundant locking; rely on MDL
Before entering DML or DDL execution in the storage engine, the SQL layer will have acquired metadata lock (MDL) on the current table name as well as the names of FOREIGN KEY (grand)child tables (that is, tables whose REFERENCES clauses point to the current table). The MDL prevents any metadata changes to these tables, such as RENAME, TRUNCATE, DROP, ALTER. While the MDL on the current table prevents dict_table_t::foreign_set from being modified, it does not prevent the table metadata that the stored pointers are pointing to from being modified. The MDL on the child tables will prevent both dict_table_t::referenced_set as well as the pointed child table metadata from being modified. wsrep_row_upd_index_is_foreign(): Do not unnecessarily acquire the data dictionary latch if Galera replication is not enabled. ha_innobase::can_switch_engines(): Rely on MDL. We are not dereferencing any pointers stored in the sets. row_mysql_freeze_data_dictionary(), row_mysql_unfreeze_data_dictionary(): Remove. row_update_for_mysql(): Call init_fts_doc_id_for_ref() only once. In ALTER TABLE...IMPORT TABLESPACE and FLUSH TABLES...FOR EXPORT the SQL layer is protecting the current table with MDL. We do not need InnoDB latches.
Showing
Please register or sign in to comment