Commit 070a8754 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-12024 InnoDB startup fails to wait for recv_writer_thread to finish

recv_writer_thread(): Do not assign recv_writer_thread_active=true
in order to avoid a race condition with
recv_recovery_from_checkpoint_finish().

recv_init_crash_recovery_spaces(): Assign recv_writer_thread_active=true
before creating recv_writer_thread.
parent bae2fc1f
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2017, 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
......@@ -288,9 +289,6 @@ number (FIL_PAGE_LSN) is in the future. Initially FALSE, and set by
recv_recovery_from_checkpoint_start(). */
extern bool recv_lsn_checks_on;
/** Flag indicating if recv_writer thread is active. */
extern volatile bool recv_writer_thread_active;
/** Size of the parsing buffer; it must accommodate RECV_SCAN_SIZE many
times! */
#define RECV_PARSING_BUF_SIZE (2 * 1024 * 1024)
......
......@@ -128,7 +128,7 @@ mysql_pfs_key_t recv_writer_thread_key;
#endif /* UNIV_PFS_THREAD */
/** Flag indicating if recv_writer thread is active. */
volatile bool recv_writer_thread_active = false;
static volatile bool recv_writer_thread_active;
#ifndef DBUG_OFF
/** Return string name of the redo log record type.
......@@ -559,8 +559,6 @@ DECLARE_THREAD(recv_writer_thread)(
<< os_thread_pf(os_thread_get_curr_id());
#endif /* UNIV_DEBUG_THREAD_CREATION */
recv_writer_thread_active = true;
while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
/* Wait till we get a signal to clean the LRU list.
......@@ -3167,6 +3165,7 @@ recv_init_crash_recovery_spaces(void)
if (srv_force_recovery < SRV_FORCE_NO_LOG_REDO) {
/* Spawn the background thread to flush dirty pages
from the buffer pools. */
recv_writer_thread_active = true;
os_thread_create(recv_writer_thread, 0, 0);
}
......
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