Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ thd_destructor_proxy(void *)
myvar->current_cond = &thd_destructor_cond;

mysql_mutex_lock(&thd_destructor_mutex);
srv_running = myvar;
my_atomic_storeptr_explicit(&srv_running, myvar,
MY_MEMORY_ORDER_RELAXED);
/* wait until the server wakes the THD to abort and die */
while (!srv_running->abort)
mysql_cond_wait(&thd_destructor_cond, &thd_destructor_mutex);
Expand Down Expand Up @@ -4209,7 +4210,8 @@ innobase_init(
mysql_thread_create(thd_destructor_thread_key,
&thd_destructor_thread,
NULL, thd_destructor_proxy, NULL);
while (!srv_running)
while (!my_atomic_loadptr_explicit(&srv_running,
MY_MEMORY_ORDER_RELAXED))
os_thread_sleep(20);
}

Expand Down
3 changes: 2 additions & 1 deletion storage/innobase/include/ib0mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,8 @@ struct TTASEventMutex {
int32 state() const
UNIV_NOTHROW
{
return(m_lock_word);
return(my_atomic_load32_explicit(&m_lock_word,
MY_MEMORY_ORDER_RELAXED));
}

/** The event that the mutex will wait in sync0arr.cc
Expand Down
19 changes: 14 additions & 5 deletions storage/innobase/srv/srv0srv.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1162,7 +1162,8 @@ srv_refresh_innodb_monitor_stats(void)
{
mutex_enter(&srv_innodb_monitor_mutex);

srv_last_monitor_time = time(NULL);
my_atomic_store32_explicit(&srv_last_monitor_time, time(NULL),
MY_MEMORY_ORDER_RELAXED);

os_aio_refresh_stats();

Expand Down Expand Up @@ -1216,10 +1217,14 @@ srv_printf_innodb_monitor(
by zero if two users happen to call SHOW ENGINE INNODB STATUS at the
same time */

time_elapsed = difftime(current_time, srv_last_monitor_time)
time_elapsed =
difftime(current_time,
my_atomic_load32_explicit(&srv_last_monitor_time,
MY_MEMORY_ORDER_RELAXED))
+ 0.001;

srv_last_monitor_time = time(NULL);
my_atomic_store32_explicit(&srv_last_monitor_time, time(NULL),
MY_MEMORY_ORDER_RELAXED);

fputs("\n=====================================\n", file);

Expand Down Expand Up @@ -1696,7 +1701,8 @@ DECLARE_THREAD(srv_monitor_thread)(void*)
pfs_register_thread(srv_monitor_thread_key);
#endif /* UNIV_PFS_THREAD */

srv_last_monitor_time = ut_time();
my_atomic_store32_explicit(&srv_last_monitor_time, ut_time(),
MY_MEMORY_ORDER_RELAXED);
last_monitor_time = ut_time();
mutex_skipped = 0;
last_srv_print_monitor = srv_print_innodb_monitor;
Expand Down Expand Up @@ -1829,7 +1835,10 @@ DECLARE_THREAD(srv_error_monitor_thread)(void*)
old_lsn = new_lsn;
}

if (difftime(time(NULL), srv_last_monitor_time) > 60) {
if (difftime(time(NULL),
my_atomic_load32_explicit(&srv_last_monitor_time,
MY_MEMORY_ORDER_RELAXED))
> 60) {
/* We referesh InnoDB Monitor values so that averages are
printed from at most 60 last seconds */

Expand Down