• Marko Mäkelä's avatar
    MDEV-12699 preparation: Clean up recv_sys · 1d30b7b1
    Marko Mäkelä authored
    The recv_sys data structures are accessed not only from the thread
    that executes InnoDB plugin initialization, but also from the
    InnoDB I/O threads, which can invoke recv_recover_page().
    
    Assert that sufficient concurrency control is in place.
    Some code was accessing recv_sys data structures without
    holding recv_sys->mutex.
    
    recv_recover_page(bpage): Refactor the call from buf_page_io_complete()
    into a separate function that performs necessary steps. The
    main thread was unnecessarily releasing and reacquiring recv_sys->mutex.
    
    recv_recover_page(block,mtr,recv_addr): Pass more parameters from
    the caller. Avoid redundant lookups and computations. Eliminate some
    redundant variables.
    
    recv_get_fil_addr_struct(): Assert that recv_sys->mutex is being held.
    That was not always the case!
    
    recv_scan_log_recs(): Acquire recv_sys->mutex for the whole duration
    of the function. (While we are scanning and buffering redo log records,
    no pages can be read in.)
    
    recv_read_in_area(): Properly protect access with recv_sys->mutex.
    
    recv_apply_hashed_log_recs(): Check recv_addr->state only once,
    and continuously hold recv_sys->mutex. The mutex will be released
    and reacquired inside recv_recover_page() and recv_read_in_area(),
    allowing concurrent processing by buf_page_io_complete() in I/O threads.
    1d30b7b1
log0recv.h 12 KB