diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 50750364956..541091d845f 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -3133,12 +3133,6 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)( os_thread_create */ { my_thread_init(); - ulint next_loop_time = ut_time_ms() + 1000; - ulint n_flushed = 0; - ulint last_activity = srv_get_activity_count(); - ulint last_pages = 0; - - my_thread_init(); #ifdef UNIV_PFS_THREAD pfs_register_thread(page_cleaner_thread_key); #endif /* UNIV_PFS_THREAD */ @@ -3160,6 +3154,8 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)( " page cleaner thread priority can be changed." " See the man page of setpriority()."; } + /* Signal that setpriority() has been attempted. */ + os_event_set(recv_sys->flush_end); #endif /* UNIV_LINUX */ while (!srv_read_only_mode @@ -3203,12 +3199,16 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)( os_event_wait(buf_flush_event); - ulint ret_sleep = 0; - ulint n_evicted = 0; - ulint n_flushed_last = 0; - ulint warn_interval = 1; - ulint warn_count = 0; - int64_t sig_count = os_event_reset(buf_flush_event); + ulint ret_sleep = 0; + ulint n_evicted = 0; + ulint n_flushed_last = 0; + ulint warn_interval = 1; + ulint warn_count = 0; + int64_t sig_count = os_event_reset(buf_flush_event); + ulint next_loop_time = ut_time_ms() + 1000; + ulint n_flushed = 0; + ulint last_activity = srv_get_activity_count(); + ulint last_pages = 0; while (srv_shutdown_state == SRV_SHUTDOWN_NONE) { diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index a6b21e3893f..7fbf069257d 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1861,6 +1861,10 @@ innobase_start_or_create_for_mysql() NULL, NULL); } +#ifdef UNIV_LINUX + /* Wait for the setpriority() call to finish. */ + os_event_wait(recv_sys->flush_end); +#endif /* UNIV_LINUX */ srv_start_state_set(SRV_START_STATE_IO); }