lock0lock.c:

  Fix a spurious deadlock introduced in the previous fix when next-key locks are requested for a page supremum record
parent 0fd577d0
...@@ -1384,8 +1384,10 @@ lock_table_has( ...@@ -1384,8 +1384,10 @@ lock_table_has(
/*============= FUNCTIONS FOR ANALYZING RECORD LOCK QUEUE ================*/ /*============= FUNCTIONS FOR ANALYZING RECORD LOCK QUEUE ================*/
/************************************************************************* /*************************************************************************
Checks if a transaction has a GRANTED explicit non-gap lock on rec, stronger Checks if a transaction has a GRANTED explicit lock on rec, where the gap
or equal to mode. */ flag or the insert intention flag is not set, stronger or equal to mode.
Note that locks on the supremum of a page are a special case here, since
they are always gap type locks, even if the gap flag is not set in them. */
UNIV_INLINE UNIV_INLINE
lock_t* lock_t*
lock_rec_has_expl( lock_rec_has_expl(
...@@ -1406,9 +1408,9 @@ lock_rec_has_expl( ...@@ -1406,9 +1408,9 @@ lock_rec_has_expl(
if (lock->trx == trx if (lock->trx == trx
&& lock_mode_stronger_or_eq(lock_get_mode(lock), mode) && lock_mode_stronger_or_eq(lock_get_mode(lock), mode)
&& !lock_get_wait(lock) && !lock_get_wait(lock)
&& !lock_rec_get_insert_intention(lock) /* we play safe */ && !lock_rec_get_insert_intention(lock)
&& !(lock_rec_get_gap(lock) && !lock_rec_get_gap(lock)) {
|| page_rec_is_supremum(rec))) {
return(lock); return(lock);
} }
...@@ -1808,7 +1810,8 @@ This is a fast routine for locking a record in the most common cases: ...@@ -1808,7 +1810,8 @@ This is a fast routine for locking a record in the most common cases:
there are no explicit locks on the page, or there is just one lock, owned there are no explicit locks on the page, or there is just one lock, owned
by this transaction, and of the right type_mode. This is a low-level function by this transaction, and of the right type_mode. This is a low-level function
which does NOT look at implicit locks! Checks lock compatibility within which does NOT look at implicit locks! Checks lock compatibility within
explicit locks. */ explicit locks. This function sets a normal next-key lock, or in the case of
a page supremum record, a gap type lock. */
UNIV_INLINE UNIV_INLINE
ibool ibool
lock_rec_lock_fast( lock_rec_lock_fast(
...@@ -1861,7 +1864,8 @@ lock_rec_lock_fast( ...@@ -1861,7 +1864,8 @@ lock_rec_lock_fast(
/************************************************************************* /*************************************************************************
This is the general, and slower, routine for locking a record. This is a This is the general, and slower, routine for locking a record. This is a
low-level function which does NOT look at implicit locks! Checks lock low-level function which does NOT look at implicit locks! Checks lock
compatibility within explicit locks. */ compatibility within explicit locks. This function sets a normal next-key
lock, or in the case of a page supremum record, a gap type lock. */
static static
ulint ulint
lock_rec_lock_slow( lock_rec_lock_slow(
...@@ -1918,7 +1922,8 @@ lock_rec_lock_slow( ...@@ -1918,7 +1922,8 @@ lock_rec_lock_slow(
Tries to lock the specified record in the mode requested. If not immediately Tries to lock the specified record in the mode requested. If not immediately
possible, enqueues a waiting lock request. This is a low-level function possible, enqueues a waiting lock request. This is a low-level function
which does NOT look at implicit locks! Checks lock compatibility within which does NOT look at implicit locks! Checks lock compatibility within
explicit locks. */ explicit locks. This function sets a normal next-key lock, or in the case
of a page supremum record, a gap type lock. */
ulint ulint
lock_rec_lock( lock_rec_lock(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment