• Marko Mäkelä's avatar
    MDEV-21674 purge_sys.stop() fails to wait for purge workers to complete · 8b97eba3
    Marko Mäkelä authored
    Since commit 5e62b6a5 (MDEV-16264),
    purge_sys_t::stop() no longer waited for all purge activity to stop.
    
    This caused problems on FLUSH TABLES...FOR EXPORT because of
    purge running concurrently with the buffer pool flush.
    The assertion at the end of buf_flush_dirty_pages() could fail.
    
    The, implemented by Vladislav Vaintroub, aims to eliminate race
    conditions when stopping or resuming purge:
    
    waitable_task::disable(): Wait for the task to complete, then replace
    the task callback function with noop.
    
    waitable_task::enable(): Restore the original task callback function
    after disable().
    
    purge_sys_t::stop(): Invoke purge_coordinator_task.disable().
    
    purge_sys_t::resume(): Invoke purge_coordinator_task.enable().
    
    purge_sys_t::running(): Add const qualifier, and clarify the comment.
    The purge coordinator task will remain active as long as any purge
    worker task is active.
    
    purge_worker_callback(): Assert purge_sys.running().
    
    srv_purge_wakeup(): Merge with the only caller purge_sys_t::resume().
    
    purge_coordinator_task: Use static linkage.
    8b97eba3
trx0purge.h 8.38 KB