diff options
| author | Marko Mäkelä <marko.makela@mariadb.com> | 2017-02-08 15:42:15 +0200 |
|---|---|---|
| committer | Marko Mäkelä <marko.makela@mariadb.com> | 2017-02-08 15:42:15 +0200 |
| commit | 070a8754c44e29572d1fafbfece251ace23ba41d (patch) | |
| tree | 89bc3061f63329eba1ed1a448a0cc5416a9a8dfd | |
| parent | bae2fc1f3813d33ac0d5afca73d34024acf97f98 (diff) | |
| download | mariadb-git-070a8754c44e29572d1fafbfece251ace23ba41d.tar.gz | |
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.
| -rw-r--r-- | storage/innobase/include/log0recv.h | 4 | ||||
| -rw-r--r-- | storage/innobase/log/log0recv.cc | 5 |
2 files changed, 3 insertions, 6 deletions
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index acffa1b562b..b0ba72427a1 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -1,6 +1,7 @@ /***************************************************************************** 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) diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 803ce99e707..befa7e58ccd 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -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); } |
