函数lock_rec_find_similar_on_page

 

/*********************************************************************//**
Looks for a suitable type record lock struct by the same trx on the same page.
This can be used to save space when a new record lock should be set on a page:
no new struct is needed, if a suitable old is found.
@return    lock or NULL */
UNIV_INLINE
lock_t*
lock_rec_find_similar_on_page(
/*==========================*/
    ulint        type_mode,    /*!< in: lock type_mode field */
    ulint        heap_no,    /*!< in: heap number of the record */
    lock_t*        lock,        /*!< in: lock_rec_get_first_on_page() */
    const trx_t*    trx)        /*!< in: transaction */
{
    ut_ad(mutex_own(&kernel_mutex));

    while (lock != NULL) {
        if (lock->trx == trx
            && lock->type_mode == type_mode
            && lock_rec_get_n_bits(lock) > heap_no) {

            return(lock);
        }

        lock = lock_rec_get_next_on_page(lock);
    }

    return(NULL);
}

 

posted @ 2015-11-06 15:01  taek  阅读(230)  评论(0编辑  收藏  举报