• Marko Mäkelä's avatar
    MDEV-32050 preparation: Simplify ROLLBACK · ea42c4ba
    Marko Mäkelä authored
    undo_node_t::state: Replaced with bool is_temp.
    
    row_undo_rec_get(): Do not copy the undo log record.
    The motivation of the copying was to not hold latches on the undo pages
    and therefore to avoid deadlocks due to lock order inversion a.k.a.
    latching order violation: It is not allowed to wait for an index page latch
    while holding an undo page latch, because MVCC reads would first acquire
    an index page latch and then an undo page latch. But, in rollback, we
    do not actually need any latch on our own undo pages. The transaction
    that is being rolled back is the exclusive owner of its undo log records.
    They cannot be overwritten by other threads until the rollback is complete.
    Therefore, a buffer fix will protect the undo log record just fine,
    by preventing page eviction. We still must initially acquire a shared latch
    on each undo page, to avoid a race condition like the one that was fixed in
    commit b102872a.
    
    row_undo_ins_parse_undo_rec(): The first two bytes of the undo log record
    now are the pointer to the next record within the page, not a length.
    
    Reviewed by: Vladislav Lesin
    ea42c4ba
row0undo.h 4.73 KB