Skip to content

Commit 1b95118

Browse files
committed
buf_page_get_gen(): Allow BUF_GET_IF_IN_POOL with a dummy page_size
The page_size argument to buf_page_get_gen() only matters when the page is going to be loaded into the buffer pool. Allow callers to pass a dummy parameter when using BUF_GET_IF_IN_POOL (which would return NULL if the block is not in the buffer pool).
1 parent 80f2921 commit 1b95118

File tree

3 files changed

+20
-29
lines changed

3 files changed

+20
-29
lines changed

storage/innobase/btr/btr0bulk.cc

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2017, 2018, MariaDB Corporation.
4+
Copyright (c) 2017, 2019, MariaDB Corporation.
55
66
This program is free software; you can redistribute it and/or modify it under
77
the terms of the GNU General Public License as published by the Free Software
@@ -664,10 +664,9 @@ PageBulk::latch()
664664
/* In case the block is S-latched by page_cleaner. */
665665
if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock,
666666
__FILE__, __LINE__, &m_mtr)) {
667-
page_id_t page_id(dict_index_get_space(m_index), m_page_no);
668-
page_size_t page_size(dict_table_page_size(m_index->table));
669-
670-
m_block = buf_page_get_gen(page_id, page_size, RW_X_LATCH,
667+
m_block = buf_page_get_gen(page_id_t(m_index->space,
668+
m_page_no),
669+
univ_page_size, RW_X_LATCH,
671670
m_block, BUF_GET_IF_IN_POOL,
672671
__FILE__, __LINE__, &m_mtr, &m_err);
673672

storage/innobase/buf/buf0buf.cc

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4211,20 +4211,22 @@ buf_page_get_gen(
42114211
#ifdef UNIV_DEBUG
42124212
switch (mode) {
42134213
case BUF_EVICT_IF_IN_POOL:
4214-
case BUF_PEEK_IF_IN_POOL:
42154214
/* After DISCARD TABLESPACE, the tablespace would not exist,
42164215
but in IMPORT TABLESPACE, PageConverter::operator() must
42174216
replace any old pages, which were not evicted during DISCARD.
4218-
Similarly, btr_search_drop_page_hash_when_freed() must
4219-
remove any old pages. Skip the assertion on page_size. */
4217+
Skip the assertion on space_page_size. */
4218+
break;
4219+
case BUF_PEEK_IF_IN_POOL:
4220+
case BUF_GET_IF_IN_POOL:
4221+
/* The caller may pass a dummy page size,
4222+
because it does not really matter. */
42204223
break;
42214224
default:
42224225
ut_error;
42234226
case BUF_GET_NO_LATCH:
42244227
ut_ad(rw_latch == RW_NO_LATCH);
42254228
/* fall through */
42264229
case BUF_GET:
4227-
case BUF_GET_IF_IN_POOL:
42284230
case BUF_GET_IF_IN_POOL_OR_WATCH:
42294231
case BUF_GET_POSSIBLY_FREED:
42304232
bool found;

storage/innobase/log/log0recv.cc

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,35 +2261,25 @@ void recv_apply_hashed_log_recs(bool last_batch)
22612261
continue;
22622262
}
22632263

2264-
const page_id_t page_id(recv_addr->space,
2265-
recv_addr->page_no);
2266-
bool found;
2267-
const page_size_t& page_size
2268-
= fil_space_get_page_size(recv_addr->space,
2269-
&found);
2270-
2271-
ut_ad(found);
2264+
const page_id_t page_id(recv_addr->space,
2265+
recv_addr->page_no);
22722266

22732267
if (recv_addr->state == RECV_NOT_PROCESSED) {
22742268
mutex_exit(&recv_sys->mutex);
2275-
2276-
if (buf_page_peek(page_id)) {
2277-
mtr_t mtr;
2278-
mtr.start();
2279-
2280-
buf_block_t* block = buf_page_get(
2281-
page_id, page_size,
2282-
RW_X_LATCH, &mtr);
2283-
2269+
mtr_t mtr;
2270+
mtr.start();
2271+
if (buf_block_t* block = buf_page_get_gen(
2272+
page_id, univ_page_size,
2273+
RW_X_LATCH, NULL,
2274+
BUF_GET_IF_IN_POOL,
2275+
__FILE__, __LINE__, &mtr, NULL)) {
22842276
buf_block_dbg_add_level(
22852277
block, SYNC_NO_ORDER_CHECK);
2286-
22872278
recv_recover_page(FALSE, block);
2288-
mtr.commit();
22892279
} else {
22902280
recv_read_in_area(page_id);
22912281
}
2292-
2282+
mtr.commit();
22932283
mutex_enter(&recv_sys->mutex);
22942284
}
22952285
}

0 commit comments

Comments
 (0)