summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-10-16 12:09:41 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2020-10-16 12:10:50 +0530
commit11e5b48d36efa050d1774e9b75490c81ac932077 (patch)
tree480e0c59823e4b6299745aaeca4778d45ed63885
parentbb25ef63c96e127be89b15bcf6c4985acf95ab2d (diff)
downloadmariadb-git-bb-10.2-MDEV-23387.tar.gz
MDEV-23966 btr_search_sys->hash_tables accessed without taking proper ahi latchbb-10.2-MDEV-23387
In btr_search_update_hash_on_insert(), btr_search_sys->hash_tables is being accessed without taking proper ahi latch. During buffer pool resizing, btr_get_search_table() is being accessed and it leads to segmentation fault. Taking ahi lock before btr_search_sys->hash_tables.
-rw-r--r--storage/innobase/btr/btr0sea.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index ee39aacf162..56aaf280649 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -1750,10 +1750,6 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
#ifdef MYSQL_INDEX_DISABLE_AHI
if (cursor->index->disable_ahi) return;
#endif
- if (!btr_search_enabled) {
- return;
- }
-
block = btr_cur_get_block(cursor);
ut_ad(rw_lock_own(&(block->lock), RW_LOCK_X));
@@ -1797,7 +1793,7 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
}
rw_lock_t* const latch = btr_get_search_latch(index);
- hash_table_t* const table = btr_get_search_table(index);
+ hash_table_t* table;
bool locked = false;
if (!page_rec_is_infimum(rec)) {
@@ -1814,6 +1810,7 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
goto function_exit;
}
+ table = btr_get_search_table(index);
ha_insert_for_fold(table, ins_fold, block, ins_rec);
}
@@ -1829,6 +1826,8 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
if (!btr_search_enabled || !block->index) {
goto function_exit;
}
+
+ table = btr_get_search_table(index);
}
if (!left_side) {
@@ -1849,6 +1848,8 @@ check_next_rec:
if (!btr_search_enabled || !block->index) {
goto function_exit;
}
+
+ table = btr_get_search_table(index);
}
ha_insert_for_fold(table, ins_fold, block, ins_rec);
@@ -1865,6 +1866,8 @@ check_next_rec:
if (!btr_search_enabled || !block->index) {
goto function_exit;
}
+
+ table = btr_get_search_table(index);
}
if (!left_side) {