summaryrefslogtreecommitdiff
path: root/storage/innobase
diff options
context:
space:
mode:
authorShaohua Wang <shaohua.wang@oracle.com>2016-01-12 15:08:09 +0800
committerShaohua Wang <shaohua.wang@oracle.com>2016-01-12 15:15:41 +0800
commit79032a7ae1b4e000028a64ab0d2f216d4c23767b (patch)
tree5910360b6bf747c1d6acebac1818a2a1d505411e /storage/innobase
parentc06138e46d6ee789cc9cbdd0f8ed8c5f4cfbc4fb (diff)
downloadmariadb-git-79032a7ae1b4e000028a64ab0d2f216d4c23767b.tar.gz
BUG#22530768 Innodb freeze running REPLACE statements
we can see from the hang stacktrace, srv_monitor_thread is blocked when getting log_sys::mutex, so that sync_arr_wake_threads_if_sema_free cannot get a change to break the mutex deadlock. The fix is simply removing any mutex wait in srv_monitor_thread. Patch is reviewed by Sunny over IM.
Diffstat (limited to 'storage/innobase')
-rw-r--r--storage/innobase/buf/buf0flu.c7
-rw-r--r--storage/innobase/srv/srv0srv.c31
2 files changed, 21 insertions, 17 deletions
diff --git a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
index 7abd014a364..d15f2e4601e 100644
--- a/storage/innobase/buf/buf0flu.c
+++ b/storage/innobase/buf/buf0flu.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -2103,7 +2103,10 @@ buf_flush_stat_update(void)
ib_uint64_t lsn;
ulint n_flushed;
- lsn = log_get_lsn();
+ if (!log_peek_lsn(&lsn)) {
+ return;
+ }
+
if (buf_flush_stat_cur.redo == 0) {
/* First time around. Just update the current LSN
and return. */
diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
index 573488bebca..f42a4a37c80 100644
--- a/storage/innobase/srv/srv0srv.c
+++ b/storage/innobase/srv/srv0srv.c
@@ -1,6 +1,6 @@
/*****************************************************************************
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, 2009 Google Inc.
Copyright (c) 2009, Percona Inc.
@@ -2413,6 +2413,8 @@ exit_func:
/*********************************************************************//**
A thread which prints warnings about semaphore waits which have lasted
too long. These can be used to track bugs which cause hangs.
+Note: In order to make sync_arr_wake_threads_if_sema_free work as expected,
+we should avoid waiting any mutexes in this function!
@return a dummy parameter */
UNIV_INTERN
os_thread_ret_t
@@ -2450,23 +2452,22 @@ loop:
/* Try to track a strange bug reported by Harald Fuchs and others,
where the lsn seems to decrease at times */
+ if (log_peek_lsn(&new_lsn)) {
+ if (new_lsn < old_lsn) {
+ ut_print_timestamp(stderr);
+ fprintf(stderr,
+ " InnoDB: Error: old log sequence number %llu"
+ " was greater\n"
+ "InnoDB: than the new log sequence number %llu!\n"
+ "InnoDB: Please submit a bug report"
+ " to http://bugs.mysql.com\n",
+ old_lsn, new_lsn);
+ ut_ad(0);
+ }
- new_lsn = log_get_lsn();
-
- if (new_lsn < old_lsn) {
- ut_print_timestamp(stderr);
- fprintf(stderr,
- " InnoDB: Error: old log sequence number %llu"
- " was greater\n"
- "InnoDB: than the new log sequence number %llu!\n"
- "InnoDB: Please submit a bug report"
- " to http://bugs.mysql.com\n",
- old_lsn, new_lsn);
- ut_ad(0);
+ old_lsn = new_lsn;
}
- old_lsn = new_lsn;
-
if (difftime(time(NULL), srv_last_monitor_time) > 60) {
/* We referesh InnoDB Monitor values so that averages are
printed from at most 60 last seconds */