Skip to content

Commit 5dd5b6c

Browse files
committed
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.
1 parent e2bf76c commit 5dd5b6c

File tree

5 files changed

+13
-30
lines changed

5 files changed

+13
-30
lines changed

storage/innobase/btr/btr0sea.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,12 +1280,8 @@ btr_search_drop_page_hash_index(buf_block_t* block)
12801280
/** Drop any adaptive hash index entries that may point to an index
12811281
page that may be in the buffer pool, when a page is evicted from the
12821282
buffer pool or freed in a file segment.
1283-
@param[in] page_id page id
1284-
@param[in] page_size page size */
1285-
void
1286-
btr_search_drop_page_hash_when_freed(
1287-
const page_id_t& page_id,
1288-
const page_size_t& page_size)
1283+
@param[in] page_id page id */
1284+
void btr_search_drop_page_hash_when_freed(const page_id_t& page_id)
12891285
{
12901286
buf_block_t* block;
12911287
mtr_t mtr;
@@ -1301,7 +1297,7 @@ btr_search_drop_page_hash_when_freed(
13011297
are possibly holding, we cannot s-latch the page, but must
13021298
(recursively) x-latch it, even though we are only reading. */
13031299

1304-
block = buf_page_get_gen(page_id, page_size, RW_X_LATCH, NULL,
1300+
block = buf_page_get_gen(page_id, univ_page_size, RW_X_LATCH, NULL,
13051301
BUF_PEEK_IF_IN_POOL, __FILE__, __LINE__,
13061302
&mtr, &err);
13071303

storage/innobase/buf/buf0buf.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4247,14 +4247,17 @@ buf_page_get_gen(
42474247
replace any old pages, which were not evicted during DISCARD.
42484248
Skip the assertion on space_page_size. */
42494249
break;
4250+
case BUF_PEEK_IF_IN_POOL:
4251+
/* In this mode, the caller may pass a dummy page size,
4252+
because it does not really matter. */
4253+
break;
42504254
default:
42514255
ut_error;
42524256
case BUF_GET_NO_LATCH:
42534257
ut_ad(rw_latch == RW_NO_LATCH);
42544258
/* fall through */
42554259
case BUF_GET:
42564260
case BUF_GET_IF_IN_POOL:
4257-
case BUF_PEEK_IF_IN_POOL:
42584261
case BUF_GET_IF_IN_POOL_OR_WATCH:
42594262
case BUF_GET_POSSIBLY_FREED:
42604263
bool found;

storage/innobase/buf/buf0lru.cc

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,12 @@ buf_LRU_evict_from_unzip_LRU(
224224
/** Attempts to drop page hash index on a batch of pages belonging to a
225225
particular space id.
226226
@param[in] space_id space id
227-
@param[in] page_size page size
228227
@param[in] arr array of page_no
229228
@param[in] count number of entries in array */
230229
static
231230
void
232231
buf_LRU_drop_page_hash_batch(
233232
ulint space_id,
234-
const page_size_t& page_size,
235233
const ulint* arr,
236234
ulint count)
237235
{
@@ -247,7 +245,7 @@ buf_LRU_drop_page_hash_batch(
247245
in the tablespace, and a previous DROP TABLE would have
248246
already removed the AHI entries. */
249247
btr_search_drop_page_hash_when_freed(
250-
page_id_t(space_id, *arr), page_size);
248+
page_id_t(space_id, *arr));
251249
}
252250
}
253251

@@ -263,15 +261,6 @@ buf_LRU_drop_page_hash_for_tablespace(
263261
buf_pool_t* buf_pool, /*!< in: buffer pool instance */
264262
ulint id) /*!< in: space id */
265263
{
266-
bool found;
267-
const page_size_t page_size(fil_space_get_page_size(id, &found));
268-
269-
if (!found) {
270-
/* Somehow, the tablespace does not exist. Nothing to drop. */
271-
ut_ad(0);
272-
return;
273-
}
274-
275264
ulint* page_arr = static_cast<ulint*>(ut_malloc_nokey(
276265
sizeof(ulint) * BUF_LRU_DROP_SEARCH_SIZE));
277266

@@ -338,8 +327,7 @@ buf_LRU_drop_page_hash_for_tablespace(
338327
the latching order. */
339328
buf_pool_mutex_exit(buf_pool);
340329

341-
buf_LRU_drop_page_hash_batch(
342-
id, page_size, page_arr, num_entries);
330+
buf_LRU_drop_page_hash_batch(id, page_arr, num_entries);
343331

344332
num_entries = 0;
345333

@@ -371,7 +359,7 @@ buf_LRU_drop_page_hash_for_tablespace(
371359
buf_pool_mutex_exit(buf_pool);
372360

373361
/* Drop any remaining batch of search hashed pages. */
374-
buf_LRU_drop_page_hash_batch(id, page_size, page_arr, num_entries);
362+
buf_LRU_drop_page_hash_batch(id, page_arr, num_entries);
375363
ut_free(page_arr);
376364
}
377365
#endif /* BTR_CUR_HASH_ADAPT */

storage/innobase/fsp/fsp0fsp.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2973,7 +2973,7 @@ fseg_free_page_low(
29732973

29742974
if (ahi) {
29752975
btr_search_drop_page_hash_when_freed(
2976-
page_id_t(space->id, offset), page_size);
2976+
page_id_t(space->id, offset));
29772977
}
29782978
#endif /* BTR_CUR_HASH_ADAPT */
29792979

@@ -3177,8 +3177,7 @@ fseg_free_extent(
31773177

31783178
btr_search_drop_page_hash_when_freed(
31793179
page_id_t(space->id,
3180-
first_page_in_extent + i),
3181-
page_size);
3180+
first_page_in_extent + i));
31823181
}
31833182
}
31843183
}

storage/innobase/include/btr0sea.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,7 @@ page that may be in the buffer pool, when a page is evicted from the
131131
buffer pool or freed in a file segment.
132132
@param[in] page_id page id
133133
@param[in] page_size page size */
134-
void
135-
btr_search_drop_page_hash_when_freed(
136-
const page_id_t& page_id,
137-
const page_size_t& page_size);
134+
void btr_search_drop_page_hash_when_freed(const page_id_t& page_id);
138135

139136
/** Updates the page hash index when a single record is inserted on a page.
140137
@param[in] cursor cursor which was positioned to the place to insert

0 commit comments

Comments
 (0)