• Marko Mäkelä's avatar
    MDEV-34759: buf_page_get_low() is unnecessarily acquiring exclusive latch · 9db2b327
    Marko Mäkelä authored
    buf_page_ibuf_merge_try(): A new, separate function for invoking
    ibuf_merge_or_delete_for_page() when needed. Use the already requested
    page latch for determining if the call is necessary. If it is and
    if we are currently holding rw_latch==RW_S_LATCH, upgrading to an exclusive
    latch may involve waiting that another thread acquires and releases
    a U or X latch on the page. If we have to wait, we must recheck if the
    call to ibuf_merge_or_delete_for_page() is still needed. If the page
    turns out to be corrupted, we will release and fail the operation.
    Finally, the exclusive page latch will be downgraded to the originally
    requested latch.
    
    ssux_lock_impl::rd_u_upgrade_try(): Attempt to upgrade a shared lock to
    an update lock.
    
    sux_lock::s_x_upgrade_try(): Attempt to upgrade a shared lock to
    exclusive.
    
    sux_lock::s_x_upgrade(): Upgrade a shared lock to exclusive.
    Return whether a wait was elided.
    
    ssux_lock_impl::u_rd_downgrade(), sux_lock::u_s_downgrade():
    Downgrade an update lock to shared.
    9db2b327
innodb_sync-t.cc 4.13 KB