• Marko Mäkelä's avatar
    MDEV-16159 Use atomic memory access for purge_sys · cd15e764
    Marko Mäkelä authored
    Thanks to Sergey Vojtovich for feedback and many ideas.
    
    purge_state_t: Remove. The states are replaced with
    purge_sys_t::enabled() and purge_sys_t::paused() as follows:
    PURGE_STATE_INIT, PURGE_STATE_EXIT, PURGE_STATE_DISABLED: !enabled().
    PURGE_STATE_RUN, PURGE_STATE_STOP: paused() distinguishes these.
    
    purge_sys_t::m_paused: Renamed from purge_sys_t::n_stop.
    Protected by atomic memory access only, not purge_sys_t::latch.
    
    purge_sys_t::m_enabled: An atomically updated Boolean that
    replaces purge_sys_t::state.
    
    purge_sys_t::running: Remove, because it duplicates
    srv_sys.n_threads_active[SRV_PURGE].
    
    purge_sys_t::running(): Accessor for srv_sys.n_threads_active[SRV_PURGE].
    
    purge_sys_t::stop(): Renamed from trx_purge_stop().
    
    purge_sys_t::resume(): Renamed from trx_purge_run().
    Do not acquire latch; solely rely on atomics.
    
    purge_sys_t::is_initialised(), purge_sys_t::m_initialised: Remove.
    
    purge_sys_t::create(), purge_sys_t::close(): Instead of invoking
    is_initialised(), check whether event is NULL.
    
    purge_sys_t::event: Move before latch, so that fields that are
    protected by latch can reside on the same cache line with latch.
    
    srv_start_wait_for_purge_to_start(): Merge to the only caller srv_start().
    cd15e764
trx0purge.h 15.8 KB