diff options
Diffstat (limited to 'storage/innobase/include/lock0priv.ic')
-rw-r--r-- | storage/innobase/include/lock0priv.ic | 130 |
1 files changed, 12 insertions, 118 deletions
diff --git a/storage/innobase/include/lock0priv.ic b/storage/innobase/include/lock0priv.ic index 7468110deeb..e16949a4917 100644 --- a/storage/innobase/include/lock0priv.ic +++ b/storage/innobase/include/lock0priv.ic @@ -122,68 +122,6 @@ lock_rec_get_next_on_page( } /*********************************************************************//** -Gets the first record lock on a page, where the page is identified by its -file address. -@return first lock, NULL if none exists */ -UNIV_INLINE -lock_t* -lock_rec_get_first_on_page_addr( -/*============================*/ - hash_table_t* lock_hash, /* Lock hash table */ - ulint space, /*!< in: space */ - ulint page_no) /*!< in: page number */ -{ - ut_ad(lock_mutex_own()); - - for (lock_t* lock = static_cast<lock_t*>( - HASH_GET_FIRST(lock_hash, - lock_rec_hash(space, page_no))); - lock != NULL; - lock = static_cast<lock_t*>(HASH_GET_NEXT(hash, lock))) { - - if (lock->un_member.rec_lock.space == space - && lock->un_member.rec_lock.page_no == page_no) { - - return(lock); - } - } - - return(NULL); -} - -/*********************************************************************//** -Gets the first record lock on a page, where the page is identified by a -pointer to it. -@return first lock, NULL if none exists */ -UNIV_INLINE -lock_t* -lock_rec_get_first_on_page( -/*=======================*/ - hash_table_t* lock_hash, /*!< in: lock hash table */ - const buf_block_t* block) /*!< in: buffer block */ -{ - ut_ad(lock_mutex_own()); - - ulint space = block->page.id().space(); - ulint page_no = block->page.id().page_no(); - ulint hash = buf_block_get_lock_hash_val(block); - - for (lock_t* lock = static_cast<lock_t*>( - HASH_GET_FIRST(lock_hash, hash)); - lock != NULL; - lock = static_cast<lock_t*>(HASH_GET_NEXT(hash, lock))) { - - if (lock->un_member.rec_lock.space == space - && lock->un_member.rec_lock.page_no == page_no) { - - return(lock); - } - } - - return(NULL); -} - -/*********************************************************************//** Gets the next explicit lock request on a record. @return next lock, NULL if none exists or if heap_no == ULINT_UNDEFINED */ UNIV_INLINE @@ -227,16 +165,11 @@ lock_rec_get_first( const buf_block_t* block, /*!< in: block containing the record */ ulint heap_no)/*!< in: heap number of the record */ { - ut_ad(lock_mutex_own()); - - for (lock_t* lock = lock_rec_get_first_on_page(hash, block); lock; - lock = lock_rec_get_next_on_page(lock)) { - if (lock_rec_get_nth_bit(lock, heap_no)) { - return(lock); - } - } - - return(NULL); + for (lock_t *lock= lock_sys.get_first(*hash, block->page.id()); + lock; lock= lock_rec_get_next_on_page(lock)) + if (lock_rec_get_nth_bit(lock, heap_no)) + return lock; + return nullptr; } /*********************************************************************//** @@ -273,23 +206,15 @@ lock_rec_get_next_on_page_const( /*============================*/ const lock_t* lock) /*!< in: a record lock */ { - ut_ad(lock_mutex_own()); - ut_ad(lock_get_type_low(lock) == LOCK_REC); - - ulint space = lock->un_member.rec_lock.space; - ulint page_no = lock->un_member.rec_lock.page_no; - - while ((lock = static_cast<const lock_t*>(HASH_GET_NEXT(hash, lock))) - != NULL) { - - if (lock->un_member.rec_lock.space == space - && lock->un_member.rec_lock.page_no == page_no) { + ut_ad(lock_mutex_own()); + ut_ad(lock_get_type_low(lock) == LOCK_REC); - return(lock); - } - } + const page_id_t page_id(lock->un_member.rec_lock.page_id); - return(NULL); + while (!!(lock= static_cast<const lock_t*>(HASH_GET_NEXT(hash, lock)))) + if (lock->un_member.rec_lock.page_id == page_id) + break; + return lock; } /*********************************************************************//** @@ -353,37 +278,6 @@ lock_get_wait( } /*********************************************************************//** -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(lock_mutex_own()); - - for (/* No op */; - lock != NULL; - lock = lock_rec_get_next_on_page(lock)) { - - if (lock->trx == trx - && lock->type_mode == type_mode - && lock_rec_get_n_bits(lock) > heap_no) { - - return(lock); - } - } - - return(NULL); -} - -/*********************************************************************//** Checks if a transaction has the specified table lock, or stronger. This function should only be called by the thread that owns the transaction. @return lock or NULL */ |