• Marko Mäkelä's avatar
    MDEV-24789: Reduce lock_sys.wait_mutex contention · 7cf4419f
    Marko Mäkelä authored
    A performance regression was introduced by
    commit e71e6133 (MDEV-24671)
    and mostly addressed by
    commit 455514c8.
    
    The regression is likely caused by increased contention
    lock_sys.latch (former lock_sys.mutex), possibly indirectly
    caused by contention on lock_sys.wait_mutex. This change aims to
    reduce both, but further improvements will be needed.
    
    lock_wait(): Minimize the lock_sys.wait_mutex hold time.
    
    lock_sys_t::deadlock_check(): Add a parameter for indicating
    whether lock_sys.latch is exclusively locked.
    
    trx_t::was_chosen_as_deadlock_victim: Always use atomics.
    
    lock_wait_wsrep(): Assume that no mutex is being held.
    
    Deadlock::report(): Always kill the victim transaction.
    
    lock_sys_t::timeout: New counter to back MONITOR_TIMEOUT.
    7cf4419f
ha_innodb.cc 593 KB