diff options
author | Vlad Lesin <vlad_lesin@mail.ru> | 2022-09-05 20:03:00 +0300 |
---|---|---|
committer | Vlad Lesin <vlad_lesin@mail.ru> | 2022-09-07 11:55:04 +0300 |
commit | b1ea7365b8733c2f9b52a613c2fb434adab837b4 (patch) | |
tree | 647b2a67ac45cc5ecf428fb1fafb4c58e805ae44 | |
parent | 86774d4a73794900c5dfe11f4b752279642ebca0 (diff) | |
download | mariadb-git-b1ea7365b8733c2f9b52a613c2fb434adab837b4.tar.gz |
Log waiting and waited transaction info if there was lock wait timeoutbb-10.5-MDEV-28709-sup_X_lock-debug
and the waiting transaction is in prepared state and executed by slave
thread.
The commit is for custom build. If you want to push it to trunk, wrap
the code with "#ifdef UNIV_DEBUG". The same is true for the previous
commit.
-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 } |