mirror of
https://github.com/MariaDB/server.git
synced 2025-08-09 22:24:09 +03:00
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(): Assign recv_writer_thread_active=true before creating recv_writer_thread.
This commit is contained in:
@@ -174,7 +174,7 @@ UNIV_INTERN mysql_pfs_key_t recv_writer_mutex_key;
|
|||||||
# endif /* UNIV_PFS_MUTEX */
|
# endif /* UNIV_PFS_MUTEX */
|
||||||
|
|
||||||
/** Flag indicating if recv_writer thread is active. */
|
/** Flag indicating if recv_writer thread is active. */
|
||||||
UNIV_INTERN bool recv_writer_thread_active = false;
|
static volatile bool recv_writer_thread_active;
|
||||||
UNIV_INTERN os_thread_t recv_writer_thread_handle = 0;
|
UNIV_INTERN os_thread_t recv_writer_thread_handle = 0;
|
||||||
#endif /* !UNIV_HOTBACKUP */
|
#endif /* !UNIV_HOTBACKUP */
|
||||||
|
|
||||||
@@ -344,8 +344,6 @@ DECLARE_THREAD(recv_writer_thread)(
|
|||||||
os_thread_pf(os_thread_get_curr_id()));
|
os_thread_pf(os_thread_get_curr_id()));
|
||||||
#endif /* UNIV_DEBUG_THREAD_CREATION */
|
#endif /* UNIV_DEBUG_THREAD_CREATION */
|
||||||
|
|
||||||
recv_writer_thread_active = true;
|
|
||||||
|
|
||||||
while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
|
while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
|
||||||
|
|
||||||
os_thread_sleep(100000);
|
os_thread_sleep(100000);
|
||||||
@@ -2988,6 +2986,7 @@ recv_init_crash_recovery(void)
|
|||||||
|
|
||||||
/* Spawn the background thread to flush dirty pages
|
/* Spawn the background thread to flush dirty pages
|
||||||
from the buffer pools. */
|
from the buffer pools. */
|
||||||
|
recv_writer_thread_active = true;
|
||||||
recv_writer_thread_handle = os_thread_create(
|
recv_writer_thread_handle = os_thread_create(
|
||||||
recv_writer_thread, 0, 0);
|
recv_writer_thread, 0, 0);
|
||||||
}
|
}
|
||||||
|
@@ -177,7 +177,7 @@ UNIV_INTERN mysql_pfs_key_t recv_writer_mutex_key;
|
|||||||
# endif /* UNIV_PFS_MUTEX */
|
# endif /* UNIV_PFS_MUTEX */
|
||||||
|
|
||||||
/** Flag indicating if recv_writer thread is active. */
|
/** Flag indicating if recv_writer thread is active. */
|
||||||
UNIV_INTERN bool recv_writer_thread_active = false;
|
static volatile bool recv_writer_thread_active;
|
||||||
UNIV_INTERN os_thread_t recv_writer_thread_handle = 0;
|
UNIV_INTERN os_thread_t recv_writer_thread_handle = 0;
|
||||||
#endif /* !UNIV_HOTBACKUP */
|
#endif /* !UNIV_HOTBACKUP */
|
||||||
|
|
||||||
@@ -343,8 +343,6 @@ DECLARE_THREAD(recv_writer_thread)(
|
|||||||
os_thread_pf(os_thread_get_curr_id()));
|
os_thread_pf(os_thread_get_curr_id()));
|
||||||
#endif /* UNIV_DEBUG_THREAD_CREATION */
|
#endif /* UNIV_DEBUG_THREAD_CREATION */
|
||||||
|
|
||||||
recv_writer_thread_active = true;
|
|
||||||
|
|
||||||
while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
|
while (srv_shutdown_state == SRV_SHUTDOWN_NONE) {
|
||||||
|
|
||||||
os_thread_sleep(100000);
|
os_thread_sleep(100000);
|
||||||
@@ -3078,6 +3076,7 @@ recv_init_crash_recovery(void)
|
|||||||
|
|
||||||
/* Spawn the background thread to flush dirty pages
|
/* Spawn the background thread to flush dirty pages
|
||||||
from the buffer pools. */
|
from the buffer pools. */
|
||||||
|
recv_writer_thread_active = true;
|
||||||
recv_writer_thread_handle = os_thread_create(
|
recv_writer_thread_handle = os_thread_create(
|
||||||
recv_writer_thread, 0, 0);
|
recv_writer_thread, 0, 0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user