Skip to content

Commit 4beb699

Browse files
committed
MDEV-14952 Avoid repeated calls to btr_get_search_latch()
btr_cur_search_to_nth_level(), row_sel(): Do not bother to yield to waiting exclusive lock requests on the adaptive hash index latch. When the btr_search_latch was split into an array of latches in MySQL 5.7.8 as part of the Oracle Bug#20985298 fix, the "caching" of the latch across storage engine API calls was removed. Thus, X-lock requests should have a good chance of becoming served, and starvation should not be possible. btr_search_guess_on_hash(): Clean up a debug assertion.
1 parent 542ad0f commit 4beb699

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

storage/innobase/btr/btr0cur.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
44
Copyright (c) 2008, Google Inc.
55
Copyright (c) 2012, Facebook Inc.
6-
Copyright (c) 2015, 2017, MariaDB Corporation.
6+
Copyright (c) 2015, 2018, MariaDB Corporation.
77
88
Portions of this file contain modifications contributed and copyrighted by
99
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -1129,8 +1129,6 @@ btr_cur_search_to_nth_level(
11291129
&& btr_search_enabled
11301130
&& !modify_external
11311131
&& !(tuple->info_bits & REC_INFO_MIN_REC_FLAG)
1132-
&& rw_lock_get_writer(btr_get_search_latch(index))
1133-
== RW_LOCK_NOT_LOCKED
11341132
&& btr_search_guess_on_hash(index, info, tuple, mode,
11351133
latch_mode, cursor,
11361134
has_search_latch, mtr)) {

storage/innobase/btr/btr0sea.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,8 +1021,7 @@ btr_search_guess_on_hash(
10211021
}
10221022
}
10231023

1024-
ut_ad(rw_lock_get_writer(btr_get_search_latch(index)) != RW_LOCK_X);
1025-
ut_ad(rw_lock_get_reader_count(btr_get_search_latch(index)) > 0);
1024+
ut_ad(rw_lock_own(btr_get_search_latch(index), RW_LOCK_S));
10261025

10271026
rec = (rec_t*) ha_search_and_get_data(
10281027
btr_get_search_table(index), fold);

0 commit comments

Comments
 (0)