summaryrefslogtreecommitdiff
path: root/storage/innobase/btr/btr0sea.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/btr/btr0sea.cc')
-rw-r--r--storage/innobase/btr/btr0sea.cc21
1 files changed, 9 insertions, 12 deletions
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index 27b5eb33c61..c92659e9d71 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -1341,7 +1341,6 @@ btr_search_build_page_hash_index(
ulint n_recs;
ulint* folds;
const rec_t** recs;
- ulint i;
mem_heap_t* heap = NULL;
rec_offs offsets_[REC_OFFS_NORMAL_SIZE];
rec_offs* offsets = offsets_;
@@ -1478,20 +1477,12 @@ btr_search_build_page_hash_index(
btr_search_check_free_space_in_heap(index);
- hash_table_t* table = btr_get_search_table(index);
rw_lock_x_lock(ahi_latch);
if (!btr_search_enabled) {
goto exit_func;
}
- table = btr_get_search_table(index);
- if (block->index && ((block->curr_n_fields != n_fields)
- || (block->curr_n_bytes != n_bytes)
- || (block->curr_left_side != left_side))) {
- goto exit_func;
- }
-
/* This counter is decremented every time we drop page
hash index entries and is incremented here. Since we can
rebuild hash index for a page that is already hashed, we
@@ -1500,6 +1491,10 @@ btr_search_build_page_hash_index(
if (!block->index) {
assert_block_ahi_empty(block);
index->search_info->ref_count++;
+ } else if (block->curr_n_fields != n_fields
+ || block->curr_n_bytes != n_bytes
+ || block->curr_left_side != left_side) {
+ goto exit_func;
}
block->n_hash_helps = 0;
@@ -1509,9 +1504,11 @@ btr_search_build_page_hash_index(
block->curr_left_side = unsigned(left_side);
block->index = index;
- for (i = 0; i < n_cached; i++) {
-
- ha_insert_for_fold(table, folds[i], block, recs[i]);
+ {
+ hash_table_t* table = btr_get_search_table(index);
+ for (ulint i = 0; i < n_cached; i++) {
+ ha_insert_for_fold(table, folds[i], block, recs[i]);
+ }
}
MONITOR_INC(MONITOR_ADAPTIVE_HASH_PAGE_ADDED);