• Marko Mäkelä's avatar
    MDEV-25691: Simplify handlerton::drop_database for InnoDB · c366845a
    Marko Mäkelä authored
    The implementation of handlerton::drop_database in InnoDB is
    unnecessarily complex. The minimal implementation should check
    that no conflicting locks or references exist on the tables,
    delete all table metadata in a single transaction, and finally
    delete the tablespaces.
    
    Note: DROP DATABASE will delete each individual table that the
    SQL layer knows about, one table per transaction.
    The handlerton::drop_database is basically a final cleanup step
    for removing any garbage that could have been left behind
    in InnoDB due to some bug, or not having atomic DDL in the past.
    
    hash_node_t: Remove. Use the proper data type name in pointers.
    
    dict_drop_index_tree(): Do not take the table as a parameter.
    Instead, return the tablespace ID if the tablespace should be dropped
    (we are dropping a clustered index tree).
    
    fil_delete_tablespace(), fil_system_t::detach(): Return a single
    detached file handle. Multi-file tablespaces cannot be deleted
    via this interface.
    
    ha_innobase::delete_table(): Remove a work-around for non-atomic DDL
    and do not try to drop tables with similar-looking name.
    
    innodb_drop_database(): Complete rewrite.
    
    innobase_drop_database(), dict_get_first_table_name_in_db(),
    row_drop_database_for_mysql(), drop_all_foreign_keys_in_db(): Remove.
    
    row_purge_remove_clust_if_poss_low(), row_undo_ins_remove_clust_rec():
    If the tablespace is to be deleted, try to evict the table definition
    from the cache. Failing that, set dict_table_t::space to nullptr.
    
    lock_release_on_rollback(): On the rollback of CREATE TABLE, release all
    locks that the transaction had on the table, to avoid heap-use-after-free.
    c366845a
lock0lock.h 37.6 KB