• Marko Mäkelä's avatar
    MDEV-31343 Another server hang with innodb_undo_log_truncate=ON · e89bd39c
    Marko Mäkelä authored
    trx_purge_truncate_history(): While waiting for a write-fixed block
    to become available, simply wait for an exclusive latch on it.
    Also, simplify the iteration: first check for oldest_modification>2
    (to ignore clean pages or pages belonging to the temporary tablespace)
    and then compare the tablespace identifier.
    
    Before releasing buf_pool.flush_list_mutex we will buffer-fix the block
    of interest. In that way, buf_page_t::can_relocate() will not hold on
    the block and it must remain in the buffer pool until we have acquired
    an exclusive latch on it. If the block is still dirty, we will register
    it with the tablespace truncation mini-transaction; else, we will simply
    release the latch and buffer-fix and move to the next block.
    
    This also reverts commit c4d79399
    because that fix should no longer be necessary; the wait for an
    exclusive block latch should allow buf_pool_t::release_freed_page()
    on the same block to proceed.
    
    Tested by: Axel Schwenke, Matthias Leich
    e89bd39c
trx0purge.cc 39.1 KB