Commit d8ef4994 authored by inaam's avatar inaam

Forward port r1520 from branches/5.0

Patch to allow monitor threads to stop before proceeding with normal shutdown. 
Also have a separate time counter for tablespace monitor.

reviewed by: Heikki
parent 16a35ea3
......@@ -3039,10 +3039,22 @@ logs_empty_and_mark_files_at_shutdown(void)
mutex_enter(&kernel_mutex);
/* Check that there are no longer transactions. We need this wait
even for the 'very fast' shutdown, because the InnoDB layer may have
committed or prepared transactions and we don't want to lose
them. */
/* We need the monitor threads to stop before we proceed with a
normal shutdown. In case of very fast shutdown, however, we can
proceed without waiting for monitor threads. */
if (srv_fast_shutdown < 2
&& (srv_error_monitor_active
|| srv_lock_timeout_and_monitor_active)) {
mutex_exit(&kernel_mutex);
goto loop;
}
/* Check that there are no longer transactions. We need this wait even
for the 'very fast' shutdown, because the InnoDB layer may have
committed or prepared transactions and we don't want to lose them. */
if (trx_n_mysql_transactions > 0
|| UT_LIST_GET_LEN(trx_sys->trx_list) > 0) {
......@@ -3163,22 +3175,8 @@ logs_empty_and_mark_files_at_shutdown(void)
goto loop;
}
/* The lock timeout thread should now have exited */
if (srv_lock_timeout_and_monitor_active) {
goto loop;
}
/* We now let also the InnoDB error monitor thread to exit */
srv_shutdown_state = SRV_SHUTDOWN_LAST_PHASE;
if (srv_error_monitor_active) {
goto loop;
}
/* Make some checks that the server really is quiet */
ut_a(srv_n_threads_active[SRV_MASTER] == 0);
ut_a(buf_all_freed());
......
......@@ -1881,6 +1881,7 @@ srv_lock_timeout_and_monitor_thread(
double time_elapsed;
time_t current_time;
time_t last_table_monitor_time;
time_t last_tablespace_monitor_time;
time_t last_monitor_time;
ibool some_waits;
double wait_time;
......@@ -1893,6 +1894,7 @@ srv_lock_timeout_and_monitor_thread(
UT_NOT_USED(arg);
srv_last_monitor_time = time(NULL);
last_table_monitor_time = time(NULL);
last_tablespace_monitor_time = time(NULL);
last_monitor_time = time(NULL);
loop:
srv_lock_timeout_and_monitor_active = TRUE;
......@@ -1929,9 +1931,8 @@ srv_lock_timeout_and_monitor_thread(
}
if (srv_print_innodb_tablespace_monitor
&& difftime(current_time, last_table_monitor_time) > 60) {
last_table_monitor_time = time(NULL);
&& difftime(current_time, last_tablespace_monitor_time) > 60) {
last_tablespace_monitor_time = time(NULL);
fputs("========================"
"========================\n",
......@@ -2128,7 +2129,7 @@ srv_error_monitor_thread(
os_thread_sleep(2000000);
if (srv_shutdown_state < SRV_SHUTDOWN_LAST_PHASE) {
if (srv_shutdown_state < SRV_SHUTDOWN_CLEANUP) {
goto loop;
}
......
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