summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-02-16 10:53:57 +0530
committerThirunarayanan Balathandayuthapani <thiru@mariadb.com>2021-02-16 16:25:10 +0530
commitef58d920d58c1e1ee37b94730e0f1ad2d4ebd0d0 (patch)
tree3f7f48f197c121328e099ef683ab4f53c6fbdddc
parente926964cb8c2ddad2304adc3ff5739a3bb91aea3 (diff)
downloadmariadb-git-bb-10.2-MDEV-24863.tar.gz
MDEV-24863 AHI entries mismatch with the index while reloading the evicted tables.bb-10.2-MDEV-24863
- InnoDB reloads the evicted table again from dictionary. In that case, AHI entries and current index object mismatches happens. When index object mismatches then InnoDB should drop the page hash AHI entries for the block.
-rw-r--r--storage/innobase/btr/btr0sea.cc33
1 files changed, 31 insertions, 2 deletions
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index 79e6326ac1c..2ad8128f113 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -624,6 +624,12 @@ btr_search_update_hash_ref(
return;
}
+ if (cursor->index != index) {
+ ut_ad(cursor->index->id == index->id);
+ btr_search_drop_page_hash_index(block);
+ return;
+ }
+
ut_ad(block->page.id.space() == index->space);
ut_a(index == cursor->index);
ut_ad(!dict_index_is_ibuf(index));
@@ -1544,19 +1550,25 @@ btr_search_move_or_delete_hash_entries(
rw_lock_s_lock(latch);
ut_a(!new_block->index || new_block->index == index);
- ut_a(!block->index || block->index == index);
+ ut_a(!block->index || block->index->id == index->id);
ut_ad(!(new_block->index || block->index)
|| !dict_index_is_ibuf(index));
assert_block_ahi_valid(block);
assert_block_ahi_valid(new_block);
if (new_block->index) {
+drop_exit:
rw_lock_s_unlock(latch);
btr_search_drop_page_hash_index(block);
return;
}
if (block->index) {
+
+ if (block->index != index) {
+ goto drop_exit;
+ }
+
ulint n_fields = block->curr_n_fields;
ulint n_bytes = block->curr_n_bytes;
ibool left_side = block->curr_left_side;
@@ -1576,7 +1588,6 @@ btr_search_move_or_delete_hash_entries(
ut_ad(left_side == block->curr_left_side);
return;
}
-
rw_lock_s_unlock(latch);
}
@@ -1616,6 +1627,12 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor)
return;
}
+ if (index != cursor->index) {
+ ut_ad(index->id == cursor->index->id);
+ btr_search_drop_page_hash_index(block);
+ return;
+ }
+
ut_ad(block->page.id.space() == index->space);
ut_a(index == cursor->index);
ut_a(block->curr_n_fields > 0 || block->curr_n_bytes > 0);
@@ -1688,6 +1705,12 @@ btr_search_update_hash_node_on_insert(btr_cur_t* cursor)
return;
}
+ if (cursor->index != index) {
+ ut_ad(cursor->index->id == index->id);
+ btr_search_drop_page_hash_index(block);
+ return;
+ }
+
ut_a(cursor->index == index);
ut_ad(!dict_index_is_ibuf(index));
@@ -1774,6 +1797,12 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
#ifdef MYSQL_INDEX_DISABLE_AHI
ut_a(!index->disable_ahi);
#endif
+ if (index != cursor->index) {
+ ut_ad(index->id == cursor->index->id);
+ btr_search_drop_page_hash_index(block);
+ return;
+ }
+
ut_a(index == cursor->index);
ut_ad(!dict_index_is_ibuf(index));