Commit 71d30d01 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.5 into 10.6

parents 1c7d4f8d 4b166ca9
...@@ -1265,13 +1265,24 @@ void btr_search_drop_page_hash_index(buf_block_t* block) ...@@ -1265,13 +1265,24 @@ void btr_search_drop_page_hash_index(buf_block_t* block)
auto part = btr_search_sys.get_part(index_id, auto part = btr_search_sys.get_part(index_id,
block->page.id().space()); block->page.id().space());
part->latch.rd_lock(SRW_LOCK_CALL); dict_index_t* index = block->index;
bool is_freed = index && index->freed();
if (is_freed) {
part->latch.wr_lock(SRW_LOCK_CALL);
} else {
part->latch.rd_lock(SRW_LOCK_CALL);
}
assert_block_ahi_valid(block); assert_block_ahi_valid(block);
dict_index_t* index = block->index;
if (!index || !btr_search_enabled) { if (!index || !btr_search_enabled) {
part->latch.rd_unlock(); if (is_freed) {
part->latch.wr_unlock();
} else {
part->latch.rd_unlock();
}
return; return;
} }
...@@ -1290,7 +1301,9 @@ void btr_search_drop_page_hash_index(buf_block_t* block) ...@@ -1290,7 +1301,9 @@ void btr_search_drop_page_hash_index(buf_block_t* block)
/* NOTE: The AHI fields of block must not be accessed after /* NOTE: The AHI fields of block must not be accessed after
releasing search latch, as the index page might only be s-latched! */ releasing search latch, as the index page might only be s-latched! */
part->latch.rd_unlock(); if (!is_freed) {
part->latch.rd_unlock();
}
ut_a(n_fields > 0 || n_bytes > 0); ut_a(n_fields > 0 || n_bytes > 0);
...@@ -1341,16 +1354,18 @@ void btr_search_drop_page_hash_index(buf_block_t* block) ...@@ -1341,16 +1354,18 @@ void btr_search_drop_page_hash_index(buf_block_t* block)
mem_heap_free(heap); mem_heap_free(heap);
} }
part->latch.wr_lock(SRW_LOCK_CALL); if (!is_freed) {
part->latch.wr_lock(SRW_LOCK_CALL);
if (UNIV_UNLIKELY(!block->index)) { if (UNIV_UNLIKELY(!block->index)) {
/* Someone else has meanwhile dropped the hash index */ /* Someone else has meanwhile dropped the
hash index */
goto cleanup;
}
goto cleanup; ut_a(block->index == index);
} }
ut_a(block->index == index);
if (block->curr_n_fields != n_fields if (block->curr_n_fields != n_fields
|| block->curr_n_bytes != n_bytes) { || block->curr_n_bytes != n_bytes) {
......
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