Commit 5dd5b6ca authored by Marko Mäkelä's avatar Marko Mäkelä

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.
parent e2bf76cb
...@@ -1280,12 +1280,8 @@ btr_search_drop_page_hash_index(buf_block_t* block) ...@@ -1280,12 +1280,8 @@ btr_search_drop_page_hash_index(buf_block_t* block)
/** Drop any adaptive hash index entries that may point to an index /** 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 page that may be in the buffer pool, when a page is evicted from the
buffer pool or freed in a file segment. buffer pool or freed in a file segment.
@param[in] page_id page id @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)
void
btr_search_drop_page_hash_when_freed(
const page_id_t& page_id,
const page_size_t& page_size)
{ {
buf_block_t* block; buf_block_t* block;
mtr_t mtr; mtr_t mtr;
...@@ -1301,7 +1297,7 @@ btr_search_drop_page_hash_when_freed( ...@@ -1301,7 +1297,7 @@ btr_search_drop_page_hash_when_freed(
are possibly holding, we cannot s-latch the page, but must are possibly holding, we cannot s-latch the page, but must
(recursively) x-latch it, even though we are only reading. */ (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__, BUF_PEEK_IF_IN_POOL, __FILE__, __LINE__,
&mtr, &err); &mtr, &err);
......
...@@ -4247,6 +4247,10 @@ buf_page_get_gen( ...@@ -4247,6 +4247,10 @@ buf_page_get_gen(
replace any old pages, which were not evicted during DISCARD. replace any old pages, which were not evicted during DISCARD.
Skip the assertion on space_page_size. */ Skip the assertion on space_page_size. */
break; 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: default:
ut_error; ut_error;
case BUF_GET_NO_LATCH: case BUF_GET_NO_LATCH:
...@@ -4254,7 +4258,6 @@ buf_page_get_gen( ...@@ -4254,7 +4258,6 @@ buf_page_get_gen(
/* fall through */ /* fall through */
case BUF_GET: case BUF_GET:
case BUF_GET_IF_IN_POOL: case BUF_GET_IF_IN_POOL:
case BUF_PEEK_IF_IN_POOL:
case BUF_GET_IF_IN_POOL_OR_WATCH: case BUF_GET_IF_IN_POOL_OR_WATCH:
case BUF_GET_POSSIBLY_FREED: case BUF_GET_POSSIBLY_FREED:
bool found; bool found;
......
...@@ -224,14 +224,12 @@ buf_LRU_evict_from_unzip_LRU( ...@@ -224,14 +224,12 @@ buf_LRU_evict_from_unzip_LRU(
/** Attempts to drop page hash index on a batch of pages belonging to a /** Attempts to drop page hash index on a batch of pages belonging to a
particular space id. particular space id.
@param[in] space_id space id @param[in] space_id space id
@param[in] page_size page size
@param[in] arr array of page_no @param[in] arr array of page_no
@param[in] count number of entries in array */ @param[in] count number of entries in array */
static static
void void
buf_LRU_drop_page_hash_batch( buf_LRU_drop_page_hash_batch(
ulint space_id, ulint space_id,
const page_size_t& page_size,
const ulint* arr, const ulint* arr,
ulint count) ulint count)
{ {
...@@ -247,7 +245,7 @@ buf_LRU_drop_page_hash_batch( ...@@ -247,7 +245,7 @@ buf_LRU_drop_page_hash_batch(
in the tablespace, and a previous DROP TABLE would have in the tablespace, and a previous DROP TABLE would have
already removed the AHI entries. */ already removed the AHI entries. */
btr_search_drop_page_hash_when_freed( 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( ...@@ -263,15 +261,6 @@ buf_LRU_drop_page_hash_for_tablespace(
buf_pool_t* buf_pool, /*!< in: buffer pool instance */ buf_pool_t* buf_pool, /*!< in: buffer pool instance */
ulint id) /*!< in: space id */ 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<ulint*>(ut_malloc_nokey( ulint* page_arr = static_cast<ulint*>(ut_malloc_nokey(
sizeof(ulint) * BUF_LRU_DROP_SEARCH_SIZE)); sizeof(ulint) * BUF_LRU_DROP_SEARCH_SIZE));
...@@ -338,8 +327,7 @@ buf_LRU_drop_page_hash_for_tablespace( ...@@ -338,8 +327,7 @@ buf_LRU_drop_page_hash_for_tablespace(
the latching order. */ the latching order. */
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
buf_LRU_drop_page_hash_batch( buf_LRU_drop_page_hash_batch(id, page_arr, num_entries);
id, page_size, page_arr, num_entries);
num_entries = 0; num_entries = 0;
...@@ -371,7 +359,7 @@ buf_LRU_drop_page_hash_for_tablespace( ...@@ -371,7 +359,7 @@ buf_LRU_drop_page_hash_for_tablespace(
buf_pool_mutex_exit(buf_pool); buf_pool_mutex_exit(buf_pool);
/* Drop any remaining batch of search hashed pages. */ /* 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); ut_free(page_arr);
} }
#endif /* BTR_CUR_HASH_ADAPT */ #endif /* BTR_CUR_HASH_ADAPT */
......
...@@ -2973,7 +2973,7 @@ fseg_free_page_low( ...@@ -2973,7 +2973,7 @@ fseg_free_page_low(
if (ahi) { if (ahi) {
btr_search_drop_page_hash_when_freed( 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 */ #endif /* BTR_CUR_HASH_ADAPT */
...@@ -3177,8 +3177,7 @@ fseg_free_extent( ...@@ -3177,8 +3177,7 @@ fseg_free_extent(
btr_search_drop_page_hash_when_freed( btr_search_drop_page_hash_when_freed(
page_id_t(space->id, page_id_t(space->id,
first_page_in_extent + i), first_page_in_extent + i));
page_size);
} }
} }
} }
......
...@@ -131,10 +131,7 @@ page that may be in the buffer pool, when a page is evicted from the ...@@ -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. buffer pool or freed in a file segment.
@param[in] page_id page id @param[in] page_id page id
@param[in] page_size page size */ @param[in] page_size page size */
void void btr_search_drop_page_hash_when_freed(const page_id_t& page_id);
btr_search_drop_page_hash_when_freed(
const page_id_t& page_id,
const page_size_t& page_size);
/** Updates the page hash index when a single record is inserted on a page. /** 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 @param[in] cursor cursor which was positioned to the place to insert
......
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