Commit 4beb699a authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent 542ad0fa
......@@ -3,7 +3,7 @@
Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2012, Facebook Inc.
Copyright (c) 2015, 2017, MariaDB Corporation.
Copyright (c) 2015, 2018, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
......@@ -1129,8 +1129,6 @@ btr_cur_search_to_nth_level(
&& btr_search_enabled
&& !modify_external
&& !(tuple->info_bits & REC_INFO_MIN_REC_FLAG)
&& rw_lock_get_writer(btr_get_search_latch(index))
== RW_LOCK_NOT_LOCKED
&& btr_search_guess_on_hash(index, info, tuple, mode,
latch_mode, cursor,
has_search_latch, mtr)) {
......
......@@ -1021,8 +1021,7 @@ btr_search_guess_on_hash(
}
}
ut_ad(rw_lock_get_writer(btr_get_search_latch(index)) != RW_LOCK_X);
ut_ad(rw_lock_get_reader_count(btr_get_search_latch(index)) > 0);
ut_ad(rw_lock_own(btr_get_search_latch(index), RW_LOCK_S));
rec = (rec_t*) ha_search_and_get_data(
btr_get_search_table(index), fold);
......
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