summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2018-08-06 15:45:44 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2018-08-06 15:45:44 +0300
commit3b37edee1a5121e9523fa8a7f483185f402905e2 (patch)
treeba21df96f570ef6be4d501034dc0db66e3d8c5a6
parent998b1c0e75a9512bfec308da19096cbced4150ad (diff)
downloadmariadb-git-3b37edee1a5121e9523fa8a7f483185f402905e2.tar.gz
MDEV-13333: Deadlock failure that does not occur elsewhere
InnoDB executed code that is mean to execute only when Galera is used and in bad luck one of the transactions is selected incorrectly as deadlock victim. Fixed by adding wsrep_on_trx() condition before entering actual Galera transaction handling. No always repeatable test case for this issue is known.
-rw-r--r--storage/innobase/lock/lock0lock.cc5
-rw-r--r--storage/xtradb/lock/lock0lock.cc5
2 files changed, 6 insertions, 4 deletions
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 441fcace7c3..3970a559a4c 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -4963,7 +4963,7 @@ lock_table_create(
UT_LIST_ADD_LAST(trx_locks, trx->lock.trx_locks, lock);
#ifdef WITH_WSREP
- if (c_lock) {
+ if (c_lock && wsrep_on_trx(trx)) {
if (wsrep_thd_is_wsrep(trx->mysql_thd)
&& wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
UT_LIST_INSERT_AFTER(
@@ -5202,9 +5202,10 @@ lock_table_enqueue_waiting(
/* Enqueue the lock request that will wait to be granted */
#ifdef WITH_WSREP
- if (trx->lock.was_chosen_as_deadlock_victim) {
+ if (trx->lock.was_chosen_as_deadlock_victim && wsrep_on_trx(trx)) {
return(DB_DEADLOCK);
}
+
lock = lock_table_create(c_lock, table, mode | LOCK_WAIT, trx);
#else
lock = lock_table_create(table, mode | LOCK_WAIT, trx);
diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc
index 549cc411f69..2183d281b78 100644
--- a/storage/xtradb/lock/lock0lock.cc
+++ b/storage/xtradb/lock/lock0lock.cc
@@ -5003,7 +5003,7 @@ lock_table_create(
UT_LIST_ADD_LAST(trx_locks, trx->lock.trx_locks, lock);
#ifdef WITH_WSREP
- if (c_lock) {
+ if (c_lock && wsrep_on_trx(trx)) {
if (wsrep_thd_is_wsrep(trx->mysql_thd)
&& wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
UT_LIST_INSERT_AFTER(
@@ -5244,9 +5244,10 @@ lock_table_enqueue_waiting(
/* Enqueue the lock request that will wait to be granted */
#ifdef WITH_WSREP
- if (trx->lock.was_chosen_as_deadlock_victim) {
+ if (trx->lock.was_chosen_as_deadlock_victim && wsrep_on_trx(trx)) {
return(DB_DEADLOCK);
}
+
lock = lock_table_create(c_lock, table, mode | LOCK_WAIT, trx);
#else
lock = lock_table_create(table, mode | LOCK_WAIT, trx);