Commit 84c578c7 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-26547 Restoring InnoDB buffer pool dump is single-threaded for no reason

buf_read_page_background(): Remove the parameter "bool sync"
and always actually initiate a page read in the background.

buf_load(): Always submit asynchronous reads. This allows
page checksums to be verified in concurrent threads as
soon as the reads are completed.
parent 7d351f1a
...@@ -3341,16 +3341,16 @@ static void btr_cur_prefetch_siblings(const buf_block_t *block, ...@@ -3341,16 +3341,16 @@ static void btr_cur_prefetch_siblings(const buf_block_t *block,
uint32_t prev= mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_PREV)); uint32_t prev= mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_PREV));
uint32_t next= mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_NEXT)); uint32_t next= mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_NEXT));
fil_space_t *space= index->table->space;
if (prev == FIL_NULL); if (prev == FIL_NULL);
else if (index->table->space->acquire()) else if (space->acquire())
buf_read_page_background(index->table->space, buf_read_page_background(space, page_id_t(space->id, prev),
page_id_t(block->page.id().space(), prev), block->zip_size());
block->zip_size(), false);
if (next == FIL_NULL); if (next == FIL_NULL);
else if (index->table->space->acquire()) else if (space->acquire())
buf_read_page_background(index->table->space, buf_read_page_background(space, page_id_t(space->id, next),
page_id_t(block->page.id().space(), next), block->zip_size());
block->zip_size(), false);
} }
/*************************************************************//** /*************************************************************//**
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2011, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 2020, MariaDB Corporation. Copyright (c) 2017, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -678,7 +678,7 @@ buf_load() ...@@ -678,7 +678,7 @@ buf_load()
} }
space->reacquire(); space->reacquire();
buf_read_page_background(space, dump[i], zip_size, true); buf_read_page_background(space, dump[i], zip_size);
if (buf_load_abort_flag) { if (buf_load_abort_flag) {
if (space) { if (space) {
......
...@@ -501,14 +501,13 @@ an exclusive lock on the buffer frame. The flag is cleared and the x-lock ...@@ -501,14 +501,13 @@ an exclusive lock on the buffer frame. The flag is cleared and the x-lock
released by the i/o-handler thread. released by the i/o-handler thread.
@param[in,out] space tablespace @param[in,out] space tablespace
@param[in] page_id page id @param[in] page_id page id
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 */
@param[in] sync true if synchronous aio is desired */
void buf_read_page_background(fil_space_t *space, const page_id_t page_id, void buf_read_page_background(fil_space_t *space, const page_id_t page_id,
ulint zip_size, bool sync) ulint zip_size)
{ {
dberr_t err; dberr_t err;
if (buf_read_page_low(&err, space, sync, BUF_READ_ANY_PAGE, if (buf_read_page_low(&err, space, false, BUF_READ_ANY_PAGE,
page_id, zip_size, false)) { page_id, zip_size, false)) {
srv_stats.buf_pool_reads.add(1); srv_stats.buf_pool_reads.add(1);
} }
......
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2015, 2020, MariaDB Corporation. Copyright (c) 2015, 2021, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under 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 the terms of the GNU General Public License as published by the Free Software
...@@ -48,10 +48,9 @@ an exclusive lock on the buffer frame. The flag is cleared and the x-lock ...@@ -48,10 +48,9 @@ an exclusive lock on the buffer frame. The flag is cleared and the x-lock
released by the i/o-handler thread. released by the i/o-handler thread.
@param[in,out] space tablespace @param[in,out] space tablespace
@param[in] page_id page id @param[in] page_id page id
@param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 */
@param[in] sync true if synchronous aio is desired */
void buf_read_page_background(fil_space_t *space, const page_id_t page_id, void buf_read_page_background(fil_space_t *space, const page_id_t page_id,
ulint zip_size, bool sync) ulint zip_size)
MY_ATTRIBUTE((nonnull)); MY_ATTRIBUTE((nonnull));
/** Applies a random read-ahead in buf_pool if there are at least a threshold /** Applies a random read-ahead in buf_pool if there are at least a threshold
......
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