• Marko Mäkelä's avatar
    MDEV-28454 Latching order violation (and hang) in ibuf_insert_low · caa985e6
    Marko Mäkelä authored
    Since commit 2ca11234 (MDEV-26217)
    the function trx_t::commit(std::vector<pfs_os_file_t>&)
    holds exclusive lock_sys.latch while invoking fil_delete_tablespace(),
    which in turn may wait for change buffer tree latches in
    ibuf_delete_for_discarded_space().
    
    ibuf_insert_low(): If a shared lock_sys.latch cannot be acquired
    without waiting, refuse to buffer the insert. In this way, a
    deadlock with a DDL operation will be avoided.
    
    ibuf_insert_to_index_page(), ibuf_delete(): Remove redundant calls to
    record locking. In ibuf_insert_low() we already ensured that no record
    locks existed on the page. No locks can be added before the buffered
    changes have been merged.
    caa985e6
ibuf0ibuf.cc 134 KB