• Marko Mäkelä's avatar
    MDEV-33454 release row locks for non-modified rows at XA PREPARE · 17e59ed3
    Marko Mäkelä authored
    From the correctness point of view, it should be safe to release
    all locks on index records that were not modified by the transaction.
    Doing so should make the locks after XA PREPARE fully compatible
    with what would happen if the server were restarted: InnoDB table
    IX locks and exclusive record locks would be resurrected based on
    undo log records.
    
    Concurrently running transactions that are waiting for a lock may invoke
    lock_rec_convert_impl_to_expl() to create an explicit record lock object
    on behalf of the lock-owning transaction so that they can attaching
    their waiting lock request on the explicit record lock object. Explicit
    locks would be released by trx_t::release_locks() during commit or
    rollback.
    
    Any clustered index record whose DB_TRX_ID belongs to a transaction that
    is in active or XA PREPARE state will be implicitly locked by that
    transaction. On XA PREPARE, we can release explicit exclusive locks on
    records whose DB_TRX_ID does not match the current transaction identifier.
    
    lock_rec_unlock_unmodified(): Release record locks that are not implicitly
    held by the current transaction.
    
    lock_release_on_prepare_try(), lock_release_on_prepare():
    Invoke lock_rec_unlock_unmodified().
    
    row_trx_id_offset(): Declare non-static.
    
    lock_rec_unlock(): Replaces lock_rec_unlock_supremum().
    
    Reviewed by: Vladislav Lesin
    17e59ed3
lock0lock.cc 214 KB