From c104a01b5028d79f9b434a6e0e6748bee405dc67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 14 Jan 2022 17:42:19 +0200 Subject: MDEV-27500 buf_page_free() fails to drop the adaptive hash index The function buf_page_free() that was introduced in commit a35b4ae89871d8184f04abb112c385481d557dbb (MDEV-15528) failed to remove any adaptive hash index entries for the page before freeing the page. This caused an assertion failure on shutdown of 10.6 server of in the function buf_pool_t::clear_hash_index() with the expression: (s >= buf_page_t::UNFIXED || s == buf_page_t::REMOVE_HASH). The assertion would fail for a block that is in the freed state. The failing assertion was added in commit aaef2e1d8c843d1e40b1ce0c5199c3abb3c5da28 in the 10.6 branch. Thanks to Matthias Leich for finding the bug and testing the fix. --- storage/innobase/buf/buf0buf.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 37f99a94cee..5a49757e857 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2013, 2021, MariaDB Corporation. +Copyright (c) 2013, 2022, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -2500,6 +2500,11 @@ void buf_page_free(fil_space_t *space, uint32_t page, mtr_t *mtr, rw_lock_x_lock_inline(&block->lock, 0, file, line); buf_block_dbg_add_level(block, SYNC_NO_ORDER_CHECK); +#ifdef BTR_CUR_HASH_ADAPT + if (block->index) + btr_search_drop_page_hash_index(block); +#endif /* BTR_CUR_HASH_ADAPT */ + block->page.status= buf_page_t::FREED; return; } -- cgit v1.2.1