Commit 7779f8dd authored by unknown's avatar unknown

srv0srv.c:

  Protect InnoDB monitor with a mutex


innobase/srv/srv0srv.c:
  Protect InnoDB monitor with a mutex
parent 6c7f6f70
......@@ -274,6 +274,8 @@ char* srv_io_thread_op_info[SRV_MAX_N_IO_THREADS];
time_t srv_last_monitor_time;
mutex_t srv_innodb_monitor_mutex;
/*
IMPLEMENTATION OF THE SERVER MAIN PROGRAM
=========================================
......@@ -1619,6 +1621,9 @@ srv_init(void)
mutex_create(&kernel_mutex);
mutex_set_level(&kernel_mutex, SYNC_KERNEL);
mutex_create(&srv_innodb_monitor_mutex);
mutex_set_level(&srv_innodb_monitor_mutex, SYNC_NO_ORDER_CHECK);
srv_sys->threads = mem_alloc(OS_THREAD_MAX_N * sizeof(srv_slot_t));
for (i = 0; i < OS_THREAD_MAX_N; i++) {
......@@ -2146,6 +2151,8 @@ srv_sprintf_innodb_monitor(
double time_elapsed;
time_t current_time;
mutex_enter(&srv_innodb_monitor_mutex);
current_time = time(NULL);
/* We add 0.001 seconds to time_elapsed to prevent division
......@@ -2256,6 +2263,7 @@ srv_sprintf_innodb_monitor(
buf += sprintf(buf, "----------------------------\n"
"END OF INNODB MONITOR OUTPUT\n"
"============================\n");
mutex_exit(&srv_innodb_monitor_mutex);
}
/*************************************************************************
......
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