diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2021-07-26 13:12:06 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2021-07-26 21:35:48 +0300 |
commit | 42d9a009f34287f123d6e9ec7c7d2e9d6e2293cd (patch) | |
tree | d4771ebad299b5c06b1cb2eae0547d86e702d8d8 | |
parent | 11db649e7359d3fb9ba4f7213732a8a3f143762f (diff) | |
download | mariadb-git-bb-10.6-midenok-MDEV-18706.tar.gz |
Fix ib_lock_t::is_stronger()bb-10.6-midenok-MDEV-18706
New lock X|GAP|INSERT_INTENTION was considered weaker than X|GAP. That
was wrong because GAP locks without INSERT_INTENTION don't wait for
anything: that is the weakest locks.
-rw-r--r-- | storage/innobase/include/lock0priv.h | 9 | ||||
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 4 |
2 files changed, 7 insertions, 6 deletions
diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h index 71c87cd58bc..3a0d1fe1685 100644 --- a/storage/innobase/include/lock0priv.h +++ b/storage/innobase/include/lock0priv.h @@ -593,11 +593,12 @@ bool ib_lock_t::is_stronger(ulint precise_mode, ulint heap_no, const trx_t* t) c && !is_waiting() && !is_insert_intention() && (!is_record_not_gap() - || (precise_mode & LOCK_REC_NOT_GAP) /* only record */ - || heap_no == PAGE_HEAP_NO_SUPREMUM) + || heap_no == PAGE_HEAP_NO_SUPREMUM + || (precise_mode & LOCK_REC_NOT_GAP)) /* only record */ && (!is_gap() - || (precise_mode & LOCK_GAP) /* only gap */ - || heap_no == PAGE_HEAP_NO_SUPREMUM) + || heap_no == PAGE_HEAP_NO_SUPREMUM + || ((precise_mode & LOCK_GAP) && /* only gap */ + !(precise_mode & LOCK_INSERT_INTENTION))) && lock_mode_stronger_or_eq( mode(), static_cast<lock_mode>( diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 74302d0ead8..63db871ad77 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -4742,8 +4742,8 @@ static void lock_validate() /*********************************************************************//** Checks if locks of other transactions prevent an immediate insert of -a record. If they do, first tests if the query thread should anyway -be suspended for some reason; if not, then puts the transaction and +a record. If they don't, first tests if the query thread should anyway +be suspended for some reason; if they do, then puts the transaction and the query thread to the lock wait state and inserts a waiting request for a gap x-lock to the lock queue. @return DB_SUCCESS, DB_LOCK_WAIT, or DB_DEADLOCK */ |