Skip to content

Commit 09e8707

Browse files
MDEV-21826 Recovery failure : loop of Read redo log up to LSN
- This issue is caused by MDEV-19176 (bba59ab). - Problem is that there is miscalculation of available memory during recovery if innodb_buffer_pool_instances > 1. - Ignore the buffer pool instance while calculating available_memory - Removed recv_n_pool_free_frames variable and use buf_pool_get_n_pages() instead.
1 parent 6ecbb21 commit 09e8707

File tree

3 files changed

+10
-24
lines changed

3 files changed

+10
-24
lines changed

storage/innobase/buf/buf0rea.cc

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2015, 2019, MariaDB Corporation.
4+
Copyright (c) 2015, 2020, 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
@@ -925,8 +925,12 @@ buf_read_recv_pages(
925925
ulint count = 0;
926926

927927
buf_pool = buf_pool_get(cur_page_id);
928-
while (buf_pool->n_pend_reads >= recv_n_pool_free_frames / 2) {
928+
ulint limit = 0;
929+
for (ulint j = 0; j < buf_pool->n_chunks; j++) {
930+
limit += buf_pool->chunks[j].size / 2;
931+
}
929932

933+
while (buf_pool->n_pend_reads >= limit) {
930934
os_aio_simulated_wake_handler_threads();
931935
os_thread_sleep(10000);
932936

storage/innobase/include/log0recv.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
33
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
4-
Copyright (c) 2017, 2019, MariaDB Corporation.
4+
Copyright (c) 2017, 2020, 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
@@ -342,10 +342,4 @@ times! */
342342
roll-forward */
343343
#define RECV_SCAN_SIZE (4 * UNIV_PAGE_SIZE)
344344

345-
/** This many frames must be left free in the buffer pool when we scan
346-
the log and store the scanned log records in the buffer pool: we will
347-
use these free frames to read in pages when we start applying the
348-
log records to the database. */
349-
extern ulint recv_n_pool_free_frames;
350-
351345
#endif

storage/innobase/log/log0recv.cc

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
44
Copyright (c) 2012, Facebook Inc.
5-
Copyright (c) 2013, 2019, MariaDB Corporation.
5+
Copyright (c) 2013, 2020, MariaDB Corporation.
66
77
This program is free software; you can redistribute it and/or modify it under
88
the terms of the GNU General Public License as published by the Free Software
@@ -103,14 +103,6 @@ static ulint recv_previous_parsed_rec_offset;
103103
/** The 'multi' flag of the previous parsed redo log record */
104104
static ulint recv_previous_parsed_rec_is_multi;
105105

106-
/** This many frames must be left free in the buffer pool when we scan
107-
the log and store the scanned log records in the buffer pool: we will
108-
use these free frames to read in pages when we start applying the
109-
log records to the database.
110-
This is the default value. If the actual size of the buffer pool is
111-
larger than 10 MB we'll set this value to 512. */
112-
ulint recv_n_pool_free_frames;
113-
114106
/** The maximum lsn we see for a page during the recovery process. If this
115107
is bigger than the lsn we are able to scan up to, that is an indication that
116108
the recovery failed and the database may be corrupt. */
@@ -840,9 +832,6 @@ recv_sys_init()
840832
recv_sys->flush_end = os_event_create(0);
841833
}
842834

843-
recv_n_pool_free_frames =
844-
buf_pool_get_n_pages() / 3;
845-
846835
recv_sys->buf = static_cast<byte*>(
847836
ut_malloc_nokey(RECV_PARSING_BUF_SIZE));
848837

@@ -3456,9 +3445,8 @@ recv_group_scan_log_recs(
34563445
lsn_t end_lsn;
34573446
store_t store_to_hash = recv_sys->mlog_checkpoint_lsn == 0
34583447
? STORE_NO : (last_phase ? STORE_IF_EXISTS : STORE_YES);
3459-
ulint available_mem = UNIV_PAGE_SIZE
3460-
* (buf_pool_get_n_pages()
3461-
- (recv_n_pool_free_frames * srv_buf_pool_instances));
3448+
ulint available_mem = (buf_pool_get_n_pages() * 2 / 3)
3449+
<< srv_page_size_shift;
34623450

34633451
group->scanned_lsn = end_lsn = *contiguous_lsn = ut_uint64_align_down(
34643452
*contiguous_lsn, OS_FILE_LOG_BLOCK_SIZE);

0 commit comments

Comments
 (0)