• Krunal Bauskar's avatar
    MDEV-22794: Avoid potential rollback segment contention with · a0d598a4
    Krunal Bauskar authored
                increased scalability through even distribution
    
    Rollback segments are allocated to transactions in round-robin fashion.
    This is controlled by incrementing a static-scope counter named rseg_slot.
    
    Said logic is not protected by any mutex or use of atomic for the counter.
    This potentially can cause the same rollback segment to get allocated to
    N different transactions (requesting allocation at the same time).
    While this is not an issue as a rollback segment can host multiple
    transactions from contention (performance) perspective it is better to
    allocate these rollback segments in round-robin fashion.
    
    Fix for the said issue ports use of atomic for the said counter that would
    ensure the original design semantic (even distribution through round-robin)
    is retained.
    a0d598a4
trx0trx.cc 63.3 KB