• Marko Mäkelä's avatar
    MDEV-26193: Wake up purge less often · a4dc9265
    Marko Mäkelä authored
    Starting with commit 6e12ebd4
    (MDEV-25062), srv_wake_purge_thread_if_not_active() became
    more expensive operation, especially on NUMA systems, because
    instead of reading an atomic global variable trx_sys.rseg_history_len
    we are traversing up to 128 cache lines in trx_sys.history_exists().
    
    trx_t::commit_cleanup(): Do not wake up purge at all.
    We will wake up purge about once per second in srv_master_callback().
    
    srv_master_do_active_tasks(), srv_master_do_idle_tasks():
    Move some duplicated code to srv_master_callback().
    
    srv_master_callback(): Invoke purge_coordinator_timer_callback()
    to ensure that purge will be periodically woken up, even if the
    latest execution of trx_t::commit_cleanup() allowed the purge view
    to advance but did not wake up purge.
    Do not call log_free_check(), because every thread that is going
    to generate redo log is supposed to call that function anyway,
    before acquiring any page latches. Additional calls to the function
    every few seconds should not make any difference.
    
    srv_shutdown_threads(): Ensure that srv_shutdown_state can be at most
    SRV_SHUTDOWN_INITIATED in srv_master_callback(), by first invoking
    srv_master_timer.reset() before changing srv_shutdown_state.
    (Note: We first terminate the srv_master_callback and only then
    terminate the purge tasks. Thus, the purge subsystem should exist
    when srv_master_callback() invokes purge_coordinator_timer_callback()
    if it was initiated in the first place.
    a4dc9265
srv0srv.cc 59.8 KB