summaryrefslogtreecommitdiff
path: root/storage/innobase/lock
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@mariadb.com>2016-02-24 01:21:40 -0500
committerNirbhay Choubey <nirbhay@mariadb.com>2016-02-24 01:21:40 -0500
commitcceec7858f260be23b50265fb026ea68c6aefc20 (patch)
tree52251df59c4a69527435c8d682505537fb6e9692 /storage/innobase/lock
parent88576b3a805f97be44d98143b6cdfc9b820fcc84 (diff)
parentf67d6fccacfb8a2963f23448cabb67c6178d2a10 (diff)
downloadmariadb-git-cceec7858f260be23b50265fb026ea68c6aefc20.tar.gz
Merge branch '10.0-galera' into bb-10.1-serg
Diffstat (limited to 'storage/innobase/lock')
-rw-r--r--storage/innobase/lock/lock0wait.cc39
1 files changed, 38 insertions, 1 deletions
diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc
index 4f4a0eb223b..a87adcf94c0 100644
--- a/storage/innobase/lock/lock0wait.cc
+++ b/storage/innobase/lock/lock0wait.cc
@@ -33,6 +33,8 @@ Created 25/5/2010 Sunny Bains
#include "ha_prototypes.h"
#include "lock0priv.h"
+#include <mysql/service_wsrep.h>
+
/*********************************************************************//**
Print the contents of the lock_sys_t::waiting_threads array. */
static
@@ -184,6 +186,28 @@ lock_wait_table_reserve_slot(
return(NULL);
}
+#ifdef WITH_WSREP
+/*********************************************************************//**
+check if lock timeout was for priority thread,
+as a side effect trigger lock monitor
+@return false for regular lock timeout */
+static ibool
+wsrep_is_BF_lock_timeout(
+/*====================*/
+ trx_t* trx) /* in: trx to check for lock priority */
+{
+ if (wsrep_on(trx->mysql_thd) &&
+ wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
+ fprintf(stderr, "WSREP: BF lock wait long\n");
+ srv_print_innodb_monitor = TRUE;
+ srv_print_innodb_lock_monitor = TRUE;
+ os_event_set(srv_monitor_event);
+ return TRUE;
+ }
+ return FALSE;
+ }
+#endif /* WITH_WSREP */
+
/***************************************************************//**
Puts a user OS thread to wait for a lock to be released. If an error
occurs during the wait trx->error_state associated with thr is
@@ -371,9 +395,17 @@ lock_wait_suspend_thread(
if (lock_wait_timeout < 100000000
&& wait_time > (double) lock_wait_timeout) {
+#ifdef WITH_WSREP
+ if (!wsrep_on(trx->mysql_thd) ||
+ (!wsrep_is_BF_lock_timeout(trx) &&
+ trx->error_state != DB_DEADLOCK)) {
+#endif /* WITH_WSREP */
trx->error_state = DB_LOCK_WAIT_TIMEOUT;
+#ifdef WITH_WSREP
+ }
+#endif /* WITH_WSREP */
MONITOR_INC(MONITOR_TIMEOUT);
}
@@ -457,8 +489,13 @@ lock_wait_check_and_cancel(
if (trx->lock.wait_lock) {
ut_a(trx->lock.que_state == TRX_QUE_LOCK_WAIT);
-
+#ifdef WITH_WSREP
+ if (!wsrep_is_BF_lock_timeout(trx)) {
+#endif /* WITH_WSREP */
lock_cancel_waiting_and_release(trx->lock.wait_lock);
+#ifdef WITH_WSREP
+ }
+#endif /* WITH_WSREP */
}
lock_mutex_exit();