• mariadb-DebarunBanerjee's avatar
    MDEV-33543 Server hang caused by InnoDB change buffer · 90b95c61
    mariadb-DebarunBanerjee authored
    Issue: When getting a page (buf_page_get_gen) with no latch option
    (RW_NO_LATCH), the caller is not expected to follow the B-tree latching
    order. However in buf_page_get_low we try to acquire shared page latch
    unconditionally to wait for a page that is being loaded by another
    thread concurrently. In general it could lead to latch order violation
    and deadlock.
    
    Currently it affects the change buffer insert path btr_latch_prev()
    which tries to load the previous page out of order with RW_NO_LATCH and
    two concurrent inserts into IBUF tree cause deadlock. This problem is
    introduced in 10.6 by following commit.
    commit 9436c778 (MDEV-27058)
    
    Fix: While trying to latch a page with RW_NO_LATCH, always use the
    "*lock_try" interface and retry operation on failure after unfixing the
    page.
    90b95c61
buf0buf.cc 118 KB