diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-04-06 20:21:06 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-04-06 21:25:43 +0300 |
commit | 1b95118c5f60c216f8f5ed342b981e48522889b8 (patch) | |
tree | a1295afd168ed653a860044a19df380a8aa67970 | |
parent | 80f29211eb5cead5ad7520f92405f249c56f7b3a (diff) | |
download | mariadb-git-1b95118c5f60c216f8f5ed342b981e48522889b8.tar.gz |
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).
-rw-r--r-- | storage/innobase/btr/btr0bulk.cc | 9 | ||||
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 10 | ||||
-rw-r--r-- | storage/innobase/log/log0recv.cc | 30 |
3 files changed, 20 insertions, 29 deletions
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc index 906b42a8e7b..57cff1166da 100644 --- a/storage/innobase/btr/btr0bulk.cc +++ b/storage/innobase/btr/btr0bulk.cc @@ -1,7 +1,7 @@ /***************************************************************************** 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); diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 9a3ee7de275..334964049d9 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -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; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index ea9b5167420..a6b42e6c66d 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2261,35 +2261,25 @@ void recv_apply_hashed_log_recs(bool last_batch) continue; } - 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); + const page_id_t page_id(recv_addr->space, + recv_addr->page_no); 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); - + mtr_t mtr; + mtr.start(); + 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); } } |