summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2021-08-18 19:26:01 +0300
committerVlad Lesin <vlad_lesin@mail.ru>2021-08-18 19:26:01 +0300
commite85267bf0403a05f3c82fd5d782e63c11c84a4fe (patch)
tree7f6b91a6124629bf38b19f98b668e8a096774134
parent4a2595727465648f2d4e794d1b2f182345f0bee8 (diff)
downloadmariadb-git-bb-10.5-MDEV-26206-post-push.tar.gz
MDEV-26206 gap lock is not set if implicit lock existsbb-10.5-MDEV-26206-post-push
Post-push fix for 10.5+. The fix influence MDEV-14479. Before the fix lock_rec_convert_impl_to_expl() did not create explicit lock if caller's transaction owns found implicit lock(see MDEV-14479 for details). After the fix lock_rec_convert_impl_to_expl() can create explicit lock under the above conditions if the requested lock mode is not LOCK_REC_NOT_GAP. And that is why we need to check if the table is X-locked before lock_rec_convert_impl_to_expl() call.
-rw-r--r--storage/innobase/lock/lock0lock.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index e46a0a91ac5..d7ec5736826 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -5640,7 +5640,9 @@ lock_sec_rec_read_check_and_lock(
if the max trx id for the page >= min trx id for the trx list or a
database recovery is running. */
- if (!page_rec_is_supremum(rec)
+ trx_t *trx = thr_get_trx(thr);
+ if (!lock_table_has(trx, index->table, LOCK_X)
+ && !page_rec_is_supremum(rec)
&& page_get_max_trx_id(block->frame) >= trx_sys.get_min_trx_id()
&& lock_rec_convert_impl_to_expl(thr_get_trx(thr), block, rec,
index, offsets)
@@ -5650,7 +5652,6 @@ lock_sec_rec_read_check_and_lock(
}
#ifdef WITH_WSREP
- trx_t *trx= thr_get_trx(thr);
/* If transaction scanning an unique secondary key is wsrep
high priority thread (brute force) this scanning may involve
GAP-locking in the index. As this locking happens also when
@@ -5724,8 +5725,10 @@ lock_clust_rec_read_check_and_lock(
heap_no = page_rec_get_heap_no(rec);
- if (heap_no != PAGE_HEAP_NO_SUPREMUM
- && lock_rec_convert_impl_to_expl(thr_get_trx(thr), block, rec,
+ trx_t *trx = thr_get_trx(thr);
+ if (!lock_table_has(trx, index->table, LOCK_X)
+ && heap_no != PAGE_HEAP_NO_SUPREMUM
+ && lock_rec_convert_impl_to_expl(trx, block, rec,
index, offsets)
&& gap_mode == LOCK_REC_NOT_GAP) {
/* We already hold an implicit exclusive lock. */