summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2016-11-09 15:23:25 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2016-11-09 15:23:25 +0200
commit1fee0171bcc9a71eb4f1e503232682e232c0bf6e (patch)
treef2e83c60d2b0cf41e92be30debdd50cf6628c4e0 /storage
parent6ae3dd6fb4c466e0facb26261349eb9c9debd6e5 (diff)
downloadmariadb-git-1fee0171bcc9a71eb4f1e503232682e232c0bf6e.tar.gz
MDEV-10692: InnoDB: Failing assertion: lock->trx->lock.wait_lock == lock
When we enter here wait_lock could be already gone i.e. NULL, that should be allowed.
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/lock/lock0lock.cc27
-rw-r--r--storage/xtradb/lock/lock0lock.cc26
2 files changed, 51 insertions, 2 deletions
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 198e4ebf6f2..c4f9b767afe 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -900,10 +900,35 @@ lock_reset_lock_and_trx_wait(
/*=========================*/
lock_t* lock) /*!< in/out: record lock */
{
- ut_ad(lock->trx->lock.wait_lock == lock);
ut_ad(lock_get_wait(lock));
ut_ad(lock_mutex_own());
+ if (lock->trx->lock.wait_lock &&
+ lock->trx->lock.wait_lock != lock) {
+ const char* stmt=NULL;
+ const char* stmt2=NULL;
+ size_t stmt_len;
+ trx_id_t trx_id = 0;
+ stmt = innobase_get_stmt(lock->trx->mysql_thd, &stmt_len);
+
+ if (lock->trx->lock.wait_lock &&
+ lock->trx->lock.wait_lock->trx) {
+ trx_id = lock->trx->lock.wait_lock->trx->id;
+ stmt2 = innobase_get_stmt(lock->trx->lock.wait_lock->trx->mysql_thd, &stmt_len);
+ }
+
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Trx id %lu is waiting a lock in statement %s"
+ " for this trx id %lu and statement %s wait_lock %p",
+ lock->trx->id,
+ stmt ? stmt : "NULL",
+ trx_id,
+ stmt2 ? stmt2 : "NULL",
+ lock->trx->lock.wait_lock);
+
+ ut_ad(lock->trx->lock.wait_lock == lock);
+ }
+
lock->trx->lock.wait_lock = NULL;
lock->type_mode &= ~LOCK_WAIT;
}
diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc
index e626821ed7e..c56bc5e52ed 100644
--- a/storage/xtradb/lock/lock0lock.cc
+++ b/storage/xtradb/lock/lock0lock.cc
@@ -912,10 +912,34 @@ lock_reset_lock_and_trx_wait(
/*=========================*/
lock_t* lock) /*!< in/out: record lock */
{
- ut_ad(lock->trx->lock.wait_lock == lock);
ut_ad(lock_get_wait(lock));
ut_ad(lock_mutex_own());
+ if (lock->trx->lock.wait_lock &&
+ lock->trx->lock.wait_lock != lock) {
+ const char* stmt=NULL;
+ const char* stmt2=NULL;
+ size_t stmt_len;
+ trx_id_t trx_id = 0;
+ stmt = innobase_get_stmt(lock->trx->mysql_thd, &stmt_len);
+
+ if (lock->trx->lock.wait_lock &&
+ lock->trx->lock.wait_lock->trx) {
+ trx_id = lock->trx->lock.wait_lock->trx->id;
+ stmt2 = innobase_get_stmt(lock->trx->lock.wait_lock->trx->mysql_thd, &stmt_len);
+ }
+
+ ib_logf(IB_LOG_LEVEL_INFO,
+ "Trx id %lu is waiting a lock in statement %s"
+ " for this trx id %lu and statement %s wait_lock %p",
+ lock->trx->id,
+ stmt ? stmt : "NULL",
+ trx_id,
+ stmt2 ? stmt2 : "NULL",
+ lock->trx->lock.wait_lock);
+ ut_ad(lock->trx->lock.wait_lock == lock);
+ }
+
lock->trx->lock.wait_lock = NULL;
lock->type_mode &= ~LOCK_WAIT;
}