Commit 1b95118c authored by Marko Mäkelä's avatar Marko Mäkelä

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).
parent 80f29211
/*****************************************************************************
Copyright (c) 2014, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2018, MariaDB Corporation.
Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
......@@ -664,10 +664,9 @@ PageBulk::latch()
/* In case the block is S-latched by page_cleaner. */
if (!buf_page_optimistic_get(RW_X_LATCH, m_block, m_modify_clock,
__FILE__, __LINE__, &m_mtr)) {
page_id_t page_id(dict_index_get_space(m_index), m_page_no);
page_size_t page_size(dict_table_page_size(m_index->table));
m_block = buf_page_get_gen(page_id, page_size, RW_X_LATCH,
m_block = buf_page_get_gen(page_id_t(m_index->space,
m_page_no),
univ_page_size, RW_X_LATCH,
m_block, BUF_GET_IF_IN_POOL,
__FILE__, __LINE__, &m_mtr, &m_err);
......
......@@ -4211,12 +4211,15 @@ buf_page_get_gen(
#ifdef UNIV_DEBUG
switch (mode) {
case BUF_EVICT_IF_IN_POOL:
case BUF_PEEK_IF_IN_POOL:
/* After DISCARD TABLESPACE, the tablespace would not exist,
but in IMPORT TABLESPACE, PageConverter::operator() must
replace any old pages, which were not evicted during DISCARD.
Similarly, btr_search_drop_page_hash_when_freed() must
remove any old pages. Skip the assertion on page_size. */
Skip the assertion on space_page_size. */
break;
case BUF_PEEK_IF_IN_POOL:
case BUF_GET_IF_IN_POOL:
/* The caller may pass a dummy page size,
because it does not really matter. */
break;
default:
ut_error;
......@@ -4224,7 +4227,6 @@ buf_page_get_gen(
ut_ad(rw_latch == RW_NO_LATCH);
/* fall through */
case BUF_GET:
case BUF_GET_IF_IN_POOL:
case BUF_GET_IF_IN_POOL_OR_WATCH:
case BUF_GET_POSSIBLY_FREED:
bool found;
......
......@@ -2263,33 +2263,23 @@ void recv_apply_hashed_log_recs(bool last_batch)
const page_id_t page_id(recv_addr->space,
recv_addr->page_no);
bool found;
const page_size_t& page_size
= fil_space_get_page_size(recv_addr->space,
&found);
ut_ad(found);
if (recv_addr->state == RECV_NOT_PROCESSED) {
mutex_exit(&recv_sys->mutex);
if (buf_page_peek(page_id)) {
mtr_t mtr;
mtr.start();
buf_block_t* block = buf_page_get(
page_id, page_size,
RW_X_LATCH, &mtr);
if (buf_block_t* block = buf_page_get_gen(
page_id, univ_page_size,
RW_X_LATCH, NULL,
BUF_GET_IF_IN_POOL,
__FILE__, __LINE__, &mtr, NULL)) {
buf_block_dbg_add_level(
block, SYNC_NO_ORDER_CHECK);
recv_recover_page(FALSE, block);
mtr.commit();
} else {
recv_read_in_area(page_id);
}
mtr.commit();
mutex_enter(&recv_sys->mutex);
}
}
......
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