diff options
-rw-r--r-- | storage/innobase/include/lock0lock.h | 2 | ||||
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 15 | ||||
-rw-r--r-- | storage/innobase/lock/lock0wait.cc | 15 |
3 files changed, 30 insertions, 2 deletions
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 168910cfe4d..a31018ccc72 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -583,6 +583,8 @@ void lock_print_info_all_transactions( /*=============================*/ FILE* file); /*!< in: file where to print */ + +void lock_print_info_for_trx_no_lock(const trx_t *trx); /*********************************************************************//** Return approximate number or record locks (bits set in the bitmap) for this transaction. Since delete-marked records may be removed, the diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index b14e13e31d1..d4275dd4d87 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -4642,10 +4642,10 @@ lock_trx_print_locks( lock_table_print(file, lock); } - if (++i == 10) { + if (++i == 1000) { fprintf(file, - "10 LOCKS PRINTED FOR THIS TRX:" + "1000 LOCKS PRINTED FOR THIS TRX:" " SUPPRESSING FURTHER PRINTS\n"); break; @@ -4695,6 +4695,17 @@ lock_print_info_all_transactions( ut_ad(lock_validate()); } +void lock_print_info_for_trx_no_lock(const trx_t *trx) +{ + ut_ad(lock_mutex_own()); + if (UNIV_UNLIKELY(trx == (purge_sys.query ? purge_sys.query->trx : NULL))) + return; + + lock_trx_print_wait_and_mvcc_state(stderr, trx, time(nullptr)); + + lock_trx_print_locks(stderr, trx); +} + #ifdef UNIV_DEBUG /*********************************************************************//** Find the the lock in the trx_t::trx_lock_t::table_locks vector. diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc index 8182d1230ed..0d1d73db1fc 100644 --- a/storage/innobase/lock/lock0wait.cc +++ b/storage/innobase/lock/lock0wait.cc @@ -460,6 +460,21 @@ lock_wait_check_and_cancel( #ifdef WITH_WSREP if (!wsrep_is_BF_lock_timeout(trx)) { #endif /* WITH_WSREP */ + trx_t *waited_trx=trx->lock.wait_trx; + if (thd_is_replication_slave_thread(trx->mysql_thd) + && waited_trx + && trx_state_eq(waited_trx, TRX_STATE_PREPARED)) { + fprintf(stderr, + "==============> Waiting transaction: " + "id - " IB_ID_FMT " isolation level - %u, " + "waited transaction: " + "id - " IB_ID_FMT " isolation level - %u\n", + trx->id, trx->isolation_level, + waited_trx->id, waited_trx->isolation_level); + lock_print_info_for_trx_no_lock(trx); + lock_print_info_for_trx_no_lock(waited_trx); + } + lock_cancel_waiting_and_release(trx->lock.wait_lock); #ifdef WITH_WSREP } |