From 5dd5b6cadc99de9864104d71ea0b4b5674e9e0da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 26 Mar 2018 16:13:17 +0300 Subject: [PATCH] MDEV-12266: Clean up btr_search_drop_page_hash_when_freed() Remove the parameter page_size, and pass a dummy page size to buf_page_get_gen() along with BUF_PEEK_IF_IN_POOL. --- storage/innobase/btr/btr0sea.cc | 10 +++------- storage/innobase/buf/buf0buf.cc | 5 ++++- storage/innobase/buf/buf0lru.cc | 18 +++--------------- storage/innobase/fsp/fsp0fsp.cc | 5 ++--- storage/innobase/include/btr0sea.h | 5 +---- 5 files changed, 13 insertions(+), 30 deletions(-) diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index c8c5ae73404..fac42229a5c 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -1280,12 +1280,8 @@ cleanup: /** Drop any adaptive hash index entries that may point to an index page that may be in the buffer pool, when a page is evicted from the buffer pool or freed in a file segment. -@param[in] page_id page id -@param[in] page_size page size */ -void -btr_search_drop_page_hash_when_freed( - const page_id_t& page_id, - const page_size_t& page_size) +@param[in] page_id page id */ +void btr_search_drop_page_hash_when_freed(const page_id_t& page_id) { buf_block_t* block; mtr_t mtr; @@ -1301,7 +1297,7 @@ btr_search_drop_page_hash_when_freed( are possibly holding, we cannot s-latch the page, but must (recursively) x-latch it, even though we are only reading. */ - block = buf_page_get_gen(page_id, page_size, RW_X_LATCH, NULL, + block = buf_page_get_gen(page_id, univ_page_size, RW_X_LATCH, NULL, BUF_PEEK_IF_IN_POOL, __FILE__, __LINE__, &mtr, &err); diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 62a195e8b0f..65d7a112ac3 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -4247,6 +4247,10 @@ buf_page_get_gen( replace any old pages, which were not evicted during DISCARD. Skip the assertion on space_page_size. */ break; + case BUF_PEEK_IF_IN_POOL: + /* In this mode, the caller may pass a dummy page size, + because it does not really matter. */ + break; default: ut_error; case BUF_GET_NO_LATCH: @@ -4254,7 +4258,6 @@ buf_page_get_gen( /* fall through */ case BUF_GET: case BUF_GET_IF_IN_POOL: - case BUF_PEEK_IF_IN_POOL: case BUF_GET_IF_IN_POOL_OR_WATCH: case BUF_GET_POSSIBLY_FREED: bool found; diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index cdea41ff191..3c04d6f280a 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -224,14 +224,12 @@ buf_LRU_evict_from_unzip_LRU( /** Attempts to drop page hash index on a batch of pages belonging to a particular space id. @param[in] space_id space id -@param[in] page_size page size @param[in] arr array of page_no @param[in] count number of entries in array */ static void buf_LRU_drop_page_hash_batch( ulint space_id, - const page_size_t& page_size, const ulint* arr, ulint count) { @@ -247,7 +245,7 @@ buf_LRU_drop_page_hash_batch( in the tablespace, and a previous DROP TABLE would have already removed the AHI entries. */ btr_search_drop_page_hash_when_freed( - page_id_t(space_id, *arr), page_size); + page_id_t(space_id, *arr)); } } @@ -263,15 +261,6 @@ buf_LRU_drop_page_hash_for_tablespace( buf_pool_t* buf_pool, /*!< in: buffer pool instance */ ulint id) /*!< in: space id */ { - bool found; - const page_size_t page_size(fil_space_get_page_size(id, &found)); - - if (!found) { - /* Somehow, the tablespace does not exist. Nothing to drop. */ - ut_ad(0); - return; - } - ulint* page_arr = static_cast(ut_malloc_nokey( sizeof(ulint) * BUF_LRU_DROP_SEARCH_SIZE)); @@ -338,8 +327,7 @@ next_page: the latching order. */ buf_pool_mutex_exit(buf_pool); - buf_LRU_drop_page_hash_batch( - id, page_size, page_arr, num_entries); + buf_LRU_drop_page_hash_batch(id, page_arr, num_entries); num_entries = 0; @@ -371,7 +359,7 @@ next_page: buf_pool_mutex_exit(buf_pool); /* Drop any remaining batch of search hashed pages. */ - buf_LRU_drop_page_hash_batch(id, page_size, page_arr, num_entries); + buf_LRU_drop_page_hash_batch(id, page_arr, num_entries); ut_free(page_arr); } #endif /* BTR_CUR_HASH_ADAPT */ diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index a348eced948..cefcbaadc03 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -2973,7 +2973,7 @@ fseg_free_page_low( if (ahi) { btr_search_drop_page_hash_when_freed( - page_id_t(space->id, offset), page_size); + page_id_t(space->id, offset)); } #endif /* BTR_CUR_HASH_ADAPT */ @@ -3177,8 +3177,7 @@ fseg_free_extent( btr_search_drop_page_hash_when_freed( page_id_t(space->id, - first_page_in_extent + i), - page_size); + first_page_in_extent + i)); } } } diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index f32429800f8..04fb7014afe 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -131,10 +131,7 @@ page that may be in the buffer pool, when a page is evicted from the buffer pool or freed in a file segment. @param[in] page_id page id @param[in] page_size page size */ -void -btr_search_drop_page_hash_when_freed( - const page_id_t& page_id, - const page_size_t& page_size); +void btr_search_drop_page_hash_when_freed(const page_id_t& page_id); /** Updates the page hash index when a single record is inserted on a page. @param[in] cursor cursor which was positioned to the place to insert