summaryrefslogtreecommitdiff
path: root/storage/xtradb/lock
diff options
context:
space:
mode:
authorSachin Setiya <sachin.setiya@mariadb.com>2017-09-27 10:06:44 +0530
committerSachin Setiya <sachin.setiya@mariadb.com>2017-09-27 10:15:08 +0530
commit0627929f626482508cc999d854e20f3a120f927a (patch)
tree4ad2c465bf594a6a781a5459437cd9d6d1de4584 /storage/xtradb/lock
parente3dee8376885c79350d447a5f99ddc5bf03188d8 (diff)
downloadmariadb-git-0627929f626482508cc999d854e20f3a120f927a.tar.gz
MDEV-13787 Crash in persistent stats wsrep_on (thd=0x0)
Problem:- This crash happens because of thd = NULL , and while checking for wsrep_on , we no longer check for thd != NULL (MDEV-7955). So this problem is regression of MDEV-7955. However this patch not only solves this regression , It solves all regression caused by MDEV-7955 patch. To get all possible cases when thd can be null , assert(thd)/ assert(trx->mysql_thd) is place just before all wsrep_on and innodb test suite is run. And the assert which caused failure are removed with a physical check for thd != NULL. Rest assert are removed. Hopefully this method will remove all current/potential regression of MDEV-7955.
Diffstat (limited to 'storage/xtradb/lock')
-rw-r--r--storage/xtradb/lock/lock0lock.cc12
-rw-r--r--storage/xtradb/lock/lock0wait.cc4
2 files changed, 12 insertions, 4 deletions
diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc
index 40ab9d9403c..40511b60f49 100644
--- a/storage/xtradb/lock/lock0lock.cc
+++ b/storage/xtradb/lock/lock0lock.cc
@@ -1835,7 +1835,7 @@ lock_rec_other_has_conflicting(
#ifdef WITH_WSREP
if (lock_rec_has_to_wait(TRUE, trx, mode, lock, is_supremum)) {
- if (wsrep_on(trx->mysql_thd)) {
+ if (wsrep_on_trx(trx)) {
trx_mutex_enter(lock->trx);
wsrep_kill_victim(trx, lock);
trx_mutex_exit(lock->trx);
@@ -2290,7 +2290,7 @@ lock_rec_create(
#ifdef WITH_WSREP
if (c_lock &&
- wsrep_on(trx->mysql_thd) &&
+ wsrep_on_trx(trx) &&
wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
lock_t *hash = (lock_t *)c_lock->hash;
lock_t *prev = NULL;
@@ -8336,3 +8336,11 @@ lock_get_info(
return info;
}
+
+#ifdef WITH_WSREP
+bool inline
+wsrep_on_trx(const trx_t* trx)
+{
+ return trx->mysql_thd && wsrep_on(trx->mysql_thd);
+}
+#endif /* WITH_WSREP */
diff --git a/storage/xtradb/lock/lock0wait.cc b/storage/xtradb/lock/lock0wait.cc
index a447027e336..ca9d05a4829 100644
--- a/storage/xtradb/lock/lock0wait.cc
+++ b/storage/xtradb/lock/lock0wait.cc
@@ -197,7 +197,7 @@ wsrep_is_BF_lock_timeout(
/*====================*/
trx_t* trx) /* in: trx to check for lock priority */
{
- if (wsrep_on(trx->mysql_thd) &&
+ if (wsrep_on_trx(trx) &&
wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
fprintf(stderr, "WSREP: BF lock wait long\n");
srv_print_innodb_monitor = TRUE;
@@ -402,7 +402,7 @@ lock_wait_suspend_thread(
if (lock_wait_timeout < 100000000
&& wait_time > (double) lock_wait_timeout) {
#ifdef WITH_WSREP
- if (!wsrep_on(trx->mysql_thd) ||
+ if (!wsrep_on_trx(trx) ||
(!wsrep_is_BF_lock_timeout(trx) &&
trx->error_state != DB_DEADLOCK)) {
#endif /* WITH_WSREP */