• Marko Mäkelä's avatar
    MDEV-31132 Deadlock between DDL and purge of InnoDB history · 5740638c
    Marko Mäkelä authored
    log_free_check(): Assert that the caller must not hold
    exclusive lock_sys.latch. This was the case for calls from
    ibuf_delete_for_discarded_space(). This caused a deadlock with
    another thread that would be holding a latch on a dirty page
    that would need to be written so that the checkpoint would advance
    and log_free_check() could return. That other thread was waiting
    for a shared lock_sys.latch.
    
    fil_delete_tablespace(): Do not invoke ibuf_delete_for_discarded_space()
    because in DDL operations, we will be holding exclusive lock_sys.latch.
    
    trx_t::commit(std::vector<pfs_os_file_t>&), innodb_drop_database(),
    row_purge_remove_clust_if_poss_low(), row_undo_ins_remove_clust_rec(),
    row_discard_tablespace_for_mysql():
    Invoke ibuf_delete_for_discarded_space() on the deleted tablespaces after
    releasing all latches.
    5740638c
log0log.cc 38.1 KB