diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-01 14:56:21 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-01 14:57:03 +0200 |
commit | 727a2f963b4bdcea34a1aa823cd02a29d72fbb03 (patch) | |
tree | fb5d14073e5bc0a989a664c782f88ad8db9c9a27 /storage | |
parent | 0b6f193194fc2a8e981264ad03336ba94972d46a (diff) | |
download | mariadb-git-727a2f963b4bdcea34a1aa823cd02a29d72fbb03.tar.gz |
fixup 21e1d7217d60407d7de74a21bc6d0f9f1b19424e: Better workaround
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 660a8421187..6fb21740655 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -5469,14 +5469,36 @@ void lock_sys_t::cancel(trx_t *trx, lock_t *lock) /** Cancel a waiting lock request (if any) when killing a transaction */ void lock_sys_t::cancel(trx_t *trx) { - lock_sys.wr_lock(SRW_LOCK_CALL); +#if 1 /* Work around MDEV-25016 (FIXME: remove this!) */ + /* Parallel replication tests would occasionally hang if we did not + acquire exclusive lock_sys.latch here. This is not a real fix, but a + work-around! + + It would be nice if thd_need_wait_reports() did not hold when no + parallel replication is in use, and only the binlog is enabled. */ + + if (innodb_deadlock_detect && thd_need_wait_reports(trx->mysql_thd)) + { + lock_sys.wr_lock(SRW_LOCK_CALL); + mysql_mutex_lock(&lock_sys.wait_mutex); + if (lock_t *lock= trx->lock.wait_lock) + { + trx->error_state= DB_INTERRUPTED; + cancel(trx, lock); + } + lock_sys.wr_unlock(); + goto func_exit; + } +#endif + lock_sys.rd_lock(SRW_LOCK_CALL); mysql_mutex_lock(&lock_sys.wait_mutex); if (lock_t *lock= trx->lock.wait_lock) { trx->error_state= DB_INTERRUPTED; cancel(trx, lock); } - lock_sys.wr_unlock(); + lock_sys.rd_unlock(); +func_exit: lock_sys.deadlock_check(); mysql_mutex_unlock(&lock_sys.wait_mutex); } |