• Marko Mäkelä's avatar
    MDEV-35049: btr_search_check_free_space_in_heap() is a bottleneck · 7a8cc852
    Marko Mäkelä authored
    MEM_HEAP_BTR_SEARCH: Remove. Let us handle this special type of
    mem_heap_t allocations in the only compilation unit, btr0sea.cc.
    
    mem_block_info_t::ahi_block: Replaces free_block. This caches one
    buffer page for use in adaptive hash index allocations. This is
    protected by btr_search_sys_t::partition::latch. It only is
    Atomic_relaxed because btr_search_free_space() is following a
    pattern of test, lock, and test.
    
    btr_search_check_free_space(): Protect the ahi_block with a
    shared AHI partition latch. We must recheck btr_search_enabled after
    acquiring the latch in order to avoid a race condition with
    btr_search_disable(). Using a shared latch instead of an exclusive one
    should reduce contention with btr_search_guess_on_hash() and other
    operations when running with innodb_adaptive_hash_index=ON.
    
    This has been tested by running the regression test suite
    with the adaptive hash index enabled:
    ./mtr --mysqld=--loose-innodb-adaptive-hash-index=ON
    7a8cc852
mem0mem.h 10.7 KB