Skip to content
Permalink
Browse files

Minor cleanup of InnoDB shutdown

os_thread_active(): Remove.

srv_shutdown_all_bg_threads(): Assert that high-level threads
have already exited. Do not sleep if os_thread_count=0.
  • Loading branch information...
dr-m committed Jun 29, 2017
1 parent de3201d commit bb60a832ede139d24a2470a1b1217d30799d726e
Showing with 4 additions and 35 deletions.
  1. +0 −6 storage/innobase/include/os0thread.h
  2. +0 −18 storage/innobase/os/os0thread.cc
  3. +4 −11 storage/innobase/srv/srv0start.cc
@@ -151,10 +151,4 @@ os_thread_sleep(
/*============*/
ulint tm); /*!< in: time in microseconds */

/*****************************************************************//**
Check if there are threads active.
@return true if the thread count > 0. */
bool
os_thread_active();

#endif
@@ -237,21 +237,3 @@ os_thread_sleep(
select(0, NULL, NULL, NULL, &t);
#endif /* _WIN32 */
}

/*****************************************************************//**
Check if there are threads active.
@return true if the thread count > 0. */
bool
os_thread_active()
/*==============*/
{
/* All the threads have exited or are just exiting;
NOTE that the threads may not have completed their
exit yet. Should we use pthread_join() to make sure
they have exited? If we did, we would have to
remove the pthread_detach() from
os_thread_exit(). Now we just sleep 0.1
seconds and hope that is enough! */

return(my_atomic_loadlint(&os_thread_count) > 0);
}
@@ -1234,6 +1234,7 @@ static
void
srv_shutdown_all_bg_threads()
{
ut_ad(!srv_undo_sources);
srv_shutdown_state = SRV_SHUTDOWN_EXIT_THREADS;

/* All threads end up waiting for certain events. Put those events
@@ -1285,13 +1286,7 @@ srv_shutdown_all_bg_threads()

os_event_set(buf_flush_event);

/* f. dict_stats_thread is signaled from
logs_empty_and_mark_files_at_shutdown() and
should have already quit or is quitting right
now. */

if (srv_use_mtflush) {
/* g. Exit the multi threaded flush threads */
buf_mtflu_io_thread_exit();
}
}
@@ -1300,13 +1295,11 @@ srv_shutdown_all_bg_threads()
os_aio_wake_all_threads_at_shutdown();
}

const bool active = os_thread_active();

os_thread_sleep(100000);

if (!active) {
if (!os_thread_count) {
return;
}

os_thread_sleep(100000);
}

ib::warn() << os_thread_count << " threads created by InnoDB"

0 comments on commit bb60a83

Please sign in to comment.
You can’t perform that action at this time.