• Sergey Vojtovich's avatar
    MDEV-15104 - Remove trx_sys_t::rw_trx_ids · 53cc9aa5
    Sergey Vojtovich authored
    Take snapshot of registered read-write transaction identifiers directly
    from rw_trx_hash. It immediately saves one trx_sys.mutex lock, reduces
    size of another critical section protected by this mutex, and makes
    further optimisations like removing trx_sys_t::serialisation_list
    possible.
    
    Downside of this approach is bigger overhead for view opening, because
    iterating LF_HASH is more expensive compared to taking snapshot of an
    array. However for low concurrency overhead difference is negligible,
    while for high concurrency mutex is much bigger evil.
    
    Currently we still take trx_sys.mutex to serialise ReadView creation.
    This is required to keep serialisation_list ordered by trx->no as well
    as not to let purge thread to create more recent snapshot while another
    thread gets suspended during creation of older snapshot. This will
    become completely mutex free along with serialisation_list removal.
    
    Compared to previous implementation removing element from rw_trx_hash
    and serialisation_list is not atomic. We disregard all possible bad
    consequences (if there're any) since it will be solved along with
    serialisation_list removal.
    53cc9aa5
ha_innodb.cc 625 KB