• Thirunarayanan Balathandayuthapani's avatar
    MDEV-23693 Failing assertion: my_atomic_load32_explicit(&lock->lock_word,... · bc540b87
    Thirunarayanan Balathandayuthapani authored
    MDEV-23693 Failing assertion: my_atomic_load32_explicit(&lock->lock_word, MY_MEMORY_ORDER_RELAXED) == X_LOCK_DECR
    
    InnoDB frees the block lock during buffer pool shrinking when other
    thread is yet to release the block lock.  While shrinking the
    buffer pool, InnoDB allows the page to be freed unless it is buffer
    fixed. In some cases, InnoDB releases the latch after unfixing the
    block.
    
    Fix:
    ====
    - InnoDB should unfix the block after releases the latch.
    
    - Add more assertion to check buffer fix while accessing the page.
    
    - Introduced block_hint structure to store buf_block_t pointer
    and allow accessing the buf_block_t pointer only by passing a
    functor. It returns original buf_block_t* pointer if it is valid
    or nullptr if the pointer become stale.
    
    - Replace buf_block_is_uncompressed() with
    buf_pool_t::is_block_pointer()
    
    This change is motivated by a change in mysql-5.7.32:
    mysql/mysql-server@46e60de444a8fbd876cc6778a7e64a1d3426a48d
    Bug #31036301 ASSERTION FAILURE: SYNC0RW.IC:429:LOCK->LOCK_WORD
    bc540b87
btr0pcur.cc 18.4 KB