• Sergey Vojtovich's avatar
    MDEV-15246 - premature history data deletion · b782971c
    Sergey Vojtovich authored
    This is regression after bc7a1dc1 of
    MDEV-15104 - Optimise MVCC snapshot.
    
    Aforementioned revision removes mutex lock around ReadView creation,
    which allows views to be created concurrently. Effectively it
    invalidates "oldest view" approach: no single view can be considered
    oldest anymore. Instead we have to iterate trx_sys.m_views to find
    min(m_low_limit_no), min(m_low_limit_id) and all transaction ids below
    min(m_low_limit_id), which would form oldest view.
    
    Second regression comes from c0d5d7c0
    of MDEV-15104 - Optimise MVCC snapshot.
    
    It removes mutex protection around trx->no assignment, which opens up
    a gap between m_max_trx_id increment and transaction serialisation
    number becoming visible through rw_trx_hash. While we're in this gap
    concurrent thread may come and do MVCC snapshot without seeing allocated
    but not yet assigned serialisation number. Then at some point purge
    thread may clone this view. As a result it won't see newly allocated
    serialisation number and may remove "unnecessary" history data of this
    transaction from rollback segments.
    b782971c
trx0trx.cc 70.6 KB