diff options
Diffstat (limited to 'storage/innobase/btr/btr0sea.cc')
-rw-r--r-- | storage/innobase/btr/btr0sea.cc | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 68d946aa79d..5c8f97b7bcf 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -2,7 +2,7 @@ Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2017, 2020, MariaDB Corporation. +Copyright (c) 2017, 2021, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -707,6 +707,12 @@ btr_search_update_hash_ref( 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->table->space_id); ut_ad(index == cursor->index); ut_ad(!dict_index_is_ibuf(index)); @@ -1276,12 +1282,13 @@ retry: rw_lock_s_lock(&part->latch); assert_block_ahi_valid(block); - if (!block->index || !btr_search_enabled) { + dict_index_t* index = block->index; + + if (!index || !btr_search_enabled) { rw_lock_s_unlock(&part->latch); return; } - dict_index_t* index = block->index; #ifdef MYSQL_INDEX_DISABLE_AHI ut_ad(!index->disable_ahi); #endif @@ -1732,6 +1739,7 @@ btr_search_move_or_delete_hash_entries( : nullptr; if (new_block->index) { +drop_exit: btr_search_drop_page_hash_index(block); return; } @@ -1740,6 +1748,10 @@ btr_search_move_or_delete_hash_entries( return; } + if (index->freed()) { + goto drop_exit; + } + rw_lock_s_lock(ahi_latch); if (block->index) { @@ -1801,6 +1813,11 @@ void btr_search_update_hash_on_delete(btr_cur_t* cursor) return; } + if (index != cursor->index) { + btr_search_drop_page_hash_index(block); + return; + } + ut_ad(block->page.id().space() == index->table->space_id); ut_a(index == cursor->index); ut_a(block->curr_n_fields > 0 || block->curr_n_bytes > 0); @@ -1871,6 +1888,12 @@ btr_search_update_hash_node_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch) return; } + if (index != cursor->index) { + ut_ad(index->id == cursor->index->id); + btr_search_drop_page_hash_index(block); + return; + } + ut_a(cursor->index == index); ut_ad(!dict_index_is_ibuf(index)); rw_lock_x_lock(ahi_latch); @@ -1959,6 +1982,12 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor, rw_lock_t* ahi_latch) #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)); |