• Marko Mäkelä's avatar
    MDEV-30216 Read-ahead unnecessarily allocates and frees pages when a page is in the buffer pool · d6aed216
    Marko Mäkelä authored
    buf_pool_t::page_hash_contains(): Check if a page is cached.
    
    buf_read_ahead_random(), buf_read_page_background(),
    buf_read_ahead_linear(): Before invoking buf_read_page_low(),
    preallocate a buffer page for the read request.
    
    buf_read_page(), buf_page_init_for_read(), buf_read_page_low():
    Add a parameter for the buf_pool.page_hash chain, to avoid duplicated
    computations.
    
    buf_page_t::read_complete(): Only attempt recovery if an uncompressed
    page frame has been allocated.
    
    buf_page_init_for_read(): Before trying to acquire buf_pool.mutex, acquire
    an exclusive buf_pool.page_hash latch and check if the page is already
    located in the buffer pool. If the buf_pool.mutex is not immediately
    available, release both latches and acquire them in the correct order,
    and then recheck if the page is already in the buffer pool. This should
    hopefully reduce some contention on buf_pool.mutex.
    
    buf_page_init_for_read(), buf_read_page_low(): Input the "recovery needed"
    flag in the least significant bit of zip_size.
    
    buf_read_acquire(), buf_read_release(): Interface for allocating and
    freeing buffer pages for reading.
    
    buf_read_recv_pages(): Set the flag that recovery is needed.
    Other ROW_FORMAT=COMPRESSED reads during recovery
    will not need any recovery.
    d6aed216
buf0buf.cc 107 KB