diff options
-rw-r--r-- | storage/innobase/buf/buf0flu.cc | 9 | ||||
-rw-r--r-- | storage/innobase/include/log0log.ic | 10 | ||||
-rw-r--r-- | storage/xtradb/buf/buf0flu.cc | 9 | ||||
-rw-r--r-- | storage/xtradb/include/log0log.ic | 10 |
4 files changed, 26 insertions, 12 deletions
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 8d6706cec53..6b219262207 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2288,7 +2288,14 @@ page_cleaner_flush_pages_if_needed(void) ulint pct_total = 0; int age_factor = 0; - cur_lsn = log_get_lsn(); + cur_lsn = log_get_lsn_nowait(); + + /* log_get_lsn_nowait tries to get log_sys->mutex with + mutex_enter_nowait, if this does not succeed function + returns 0, do not use that value to update stats. */ + if (cur_lsn == 0) { + return(0); + } if (prev_lsn == 0) { /* First time around. */ 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); } diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc index 827e01e2096..d7d5e147cf3 100644 --- a/storage/xtradb/buf/buf0flu.cc +++ b/storage/xtradb/buf/buf0flu.cc @@ -2474,7 +2474,14 @@ page_cleaner_flush_pages_if_needed(void) ulint pct_total = 0; int age_factor = 0; - cur_lsn = log_get_lsn(); + cur_lsn = log_get_lsn_nowait(); + + /* log_get_lsn_nowait tries to get log_sys->mutex with + mutex_enter_nowait, if this does not succeed function + returns 0, do not use that value to update stats. */ + if (cur_lsn == 0) { + return(0); + } if (prev_lsn == 0) { /* First time around. */ diff --git a/storage/xtradb/include/log0log.ic b/storage/xtradb/include/log0log.ic index 853027daa7e..ff5a83be249 100644 --- a/storage/xtradb/include/log0log.ic +++ b/storage/xtradb/include/log0log.ic @@ -494,14 +494,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); } |