• Marko Mäkelä's avatar
    MDEV-24167 fixup: srw_lock_debug instrumentation · 5f2dcd11
    Marko Mäkelä authored
    While the index_lock and block_lock include debug instrumentation
    to keep track of shared lock holders, such instrumentation was
    never part of the simpler srw_lock, and therefore some users of the
    class implemented a limited form of bookkeeping.
    
    srw_lock_debug encapsulates srw_lock and adds the data members
    writer, readers_lock, and readers to keep track of the threads that
    hold the exclusive latch or any shared latches. The debug checks
    are available also with SUX_LOCK_GENERIC (in environments that do not
    implement a futex-like system call).
    
    dict_sys_t::latch: Use srw_lock_debug in debug builds.
    This makes the debug fields latch_ex, latch_readers redundant.
    
    fil_space_t::latch: Use srw_lock_debug in debug builds.
    This makes the debug field latch_count redundant.
    The field latch_owner must be preserved, because
    fil_space_t::is_owner() is being used in all builds.
    
    lock_sys_t::latch: Use srw_lock_debug in debug builds.
    This makes the debug fields writer, readers redundant.
    
    lock_sys_t::is_holder(): A new debug predicate to check if
    the current thread is holding lock_sys.latch in any mode.
    
    trx_rseg_t::latch: Use srw_lock_debug in debug builds.
    5f2dcd11
trx0rseg.h 11 KB