summaryrefslogtreecommitdiff
path: root/storage/innobase/include/log0log.ic
diff options
context:
space:
mode:
authorJan Lindström <jplindst@mariadb.org>2014-11-13 12:00:57 +0200
committerJan Lindström <jplindst@mariadb.org>2014-11-13 12:00:57 +0200
commitbff2d46bf7e922b9ac43da82df97ca929527100f (patch)
tree0f6d2a81a88aed6c6311a328896ffe1f3cac80f3 /storage/innobase/include/log0log.ic
parent84f3f3fa1e5120cc1345963046b44b31c25ae1b1 (diff)
downloadmariadb-git-bff2d46bf7e922b9ac43da82df97ca929527100f.tar.gz
MDEV-7100: InnoDB error monitor might unnecessary wait log_sys mutex
Analysis: InnoDB error monitor is responsible to call every second sync_arr_wake_threads_if_sema_free() to wake up possible hanging threads if they are missed in mutex_signal_object. This is not possible if error monitor itself is on mutex/semaphore wait. We should avoid all unnecessary mutex/semaphore waits on error monitor. Currently error monitor calls function buf_flush_stat_update() that calls log_get_lsn() function and there we will try to get log_sys mutex. Better, solution for error monitor is that in buf_flush_stat_update() we will try to get lsn with mutex_enter_nowait() and if we did not get mutex do not update the stats. Fix: Use log_get_lsn_nowait() function on buf_flush_stat_update() function. If returned lsn is 0, we do not update flush stats. log_get_lsn_nowait() will use mutex_enter_nowait() and if we get mutex we return a correct lsn if not we return 0.
Diffstat (limited to 'storage/innobase/include/log0log.ic')
-rw-r--r--storage/innobase/include/log0log.ic10
1 files changed, 5 insertions, 5 deletions
diff --git a/storage/innobase/include/log0log.ic b/storage/innobase/include/log0log.ic
index 7c79eb96ca9..38ed2b51a4e 100644
--- a/storage/innobase/include/log0log.ic
+++ b/storage/innobase/include/log0log.ic
@@ -442,14 +442,14 @@ lsn_t
log_get_lsn_nowait(void)
/*=============*/
{
- lsn_t lsn;
+ lsn_t lsn=0;
- if (mutex_enter_nowait(&(log_sys->mutex)))
- return 0;
+ if (!mutex_enter_nowait(&(log_sys->mutex))) {
- lsn = log_sys->lsn;
+ lsn = log_sys->lsn;
- mutex_exit(&(log_sys->mutex));
+ mutex_exit(&(log_sys->mutex));
+ }
return(lsn);
}