From 7d892f69a565e583eb692d01e2e80a158ee795fe Mon Sep 17 00:00:00 2001 From: Nirbhay Choubey Date: Tue, 25 Mar 2014 23:13:30 -0400 Subject: [PATCH] bzr merge -r4021..4026 codership-mysql/5.6. --- storage/innobase/lock/lock0wait.cc | 35 +++++++++++++++++++++++++++++- storage/innobase/srv/srv0srv.cc | 21 ------------------ storage/xtradb/lock/lock0wait.cc | 35 +++++++++++++++++++++++++++++- storage/xtradb/srv/srv0srv.cc | 21 ------------------ 4 files changed, 68 insertions(+), 44 deletions(-) diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc index fc355d8bb6d..f957c1855cc 100644 --- a/storage/innobase/lock/lock0wait.cc +++ b/storage/innobase/lock/lock0wait.cc @@ -184,6 +184,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_brute_force(trx->mysql_thd)) { + 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 @@ -350,9 +372,15 @@ lock_wait_suspend_thread( if (lock_wait_timeout < 100000000 && wait_time > (double) lock_wait_timeout) { +#ifdef WITH_WSREP + if (!wsrep_is_BF_lock_timeout(trx)) { +#endif /* WITH_WSREP */ trx->error_state = DB_LOCK_WAIT_TIMEOUT; +#ifdef WITH_WSREP + } +#endif /* WITH_WSREP */ MONITOR_INC(MONITOR_TIMEOUT); } @@ -436,8 +464,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(); diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 874fdd3d444..8da5a20b23e 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -2399,27 +2399,6 @@ suspend_thread: OS_THREAD_DUMMY_RETURN; /* Not reached, avoid compiler warning */ } -#ifdef WITH_WSREP_TODO -/*********************************************************************//** -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( -/*====================*/ - srv_slot_t* slot) /* in: lock slot to check for lock priority */ -{ - if (wsrep_on(thr_get_trx(slot->thr)->mysql_thd) && - wsrep_thd_is_brute_force((thr_get_trx(slot->thr))->mysql_thd)) { - fprintf(stderr, "WSREP: BF lock wait long\n"); - srv_print_innodb_monitor = TRUE; - srv_print_innodb_lock_monitor = TRUE; - os_event_set(lock_sys->timeout_event); - return TRUE; - } - return FALSE; - } -#endif /* WITH_WSREP_TODO */ /*********************************************************************//** Check if purge should stop. @return true if it should shutdown. */ diff --git a/storage/xtradb/lock/lock0wait.cc b/storage/xtradb/lock/lock0wait.cc index a1c35e20ead..0c1269f02d5 100644 --- a/storage/xtradb/lock/lock0wait.cc +++ b/storage/xtradb/lock/lock0wait.cc @@ -184,6 +184,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_brute_force(trx->mysql_thd)) { + 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 @@ -375,9 +397,15 @@ lock_wait_suspend_thread( if (lock_wait_timeout < 100000000 && wait_time > (double) lock_wait_timeout) { +#ifdef WITH_WSREP + if (!wsrep_is_BF_lock_timeout(trx)) { +#endif /* WITH_WSREP */ trx->error_state = DB_LOCK_WAIT_TIMEOUT; +#ifdef WITH_WSREP + } +#endif /* WITH_WSREP */ MONITOR_INC(MONITOR_TIMEOUT); } @@ -461,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(); diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index 46d81790fe8..6506daa3347 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -2998,27 +2998,6 @@ suspend_thread: OS_THREAD_DUMMY_RETURN; /* Not reached, avoid compiler warning */ } -#ifdef WITH_WSREP_TODO -/*********************************************************************//** -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( -/*====================*/ - srv_slot_t* slot) /* in: lock slot to check for lock priority */ -{ - if (wsrep_on(thr_get_trx(slot->thr)->mysql_thd) && - wsrep_thd_is_brute_force((thr_get_trx(slot->thr))->mysql_thd)) { - fprintf(stderr, "WSREP: BF lock wait long\n"); - srv_print_innodb_monitor = TRUE; - srv_print_innodb_lock_monitor = TRUE; - os_event_set(lock_sys->timeout_event); - return TRUE; - } - return FALSE; - } -#endif /* WITH_WSREP_TODO */ /*********************************************************************//** Check if purge should stop. @return true if it should shutdown. */