diff options
author | Eugene Kosov <claprix@yandex.ru> | 2019-04-25 20:24:10 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-04-29 15:11:06 +0300 |
commit | 61f370a3c9997d2c7067b8cf5d39c8ad67dde5aa (patch) | |
tree | 4295a54479895570690af0ecf2c288d8b5f979b7 /storage/innobase/lock | |
parent | d6e431dfa8a5653b669615cd9c9d2d206ce0d053 (diff) | |
download | mariadb-git-61f370a3c9997d2c7067b8cf5d39c8ad67dde5aa.tar.gz |
MDEV-18429 Consistent non-locking reads do not appear in TRANSACTIONS section of SHOW ENGINE INNODB STATUS
lock_print_info_all_transactions(): print transactions which are started
but not in RW or RO lists.
print_not_started(): Replaces PrintNotStarted. Collect the skipped
transactions.
Diffstat (limited to 'storage/innobase/lock')
-rw-r--r-- | storage/innobase/lock/lock0lock.cc | 51 |
1 files changed, 31 insertions, 20 deletions
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 7f6171241ac..22ec2ee7f06 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -4973,28 +4973,26 @@ lock_print_info_summary( return(TRUE); } -/** Functor to print not-started transaction from the mysql_trx_list. */ - -struct PrintNotStarted { - - PrintNotStarted(FILE* file) : m_file(file) { } - - void operator()(const trx_t* trx) - { - ut_ad(trx->in_mysql_trx_list); - ut_ad(mutex_own(&trx_sys->mutex)); +/** Prints not started transaction or puts it into set. +@param[in] trx transaction +@param[in,out] file fd where to print +@param[in,out] started put transaction here if is started */ +static void +print_not_started(const trx_t* trx, FILE* file, std::set<const trx_t*>& started) +{ + ut_ad(trx->in_mysql_trx_list); + ut_ad(mutex_own(&trx_sys->mutex)); - /* See state transitions and locking rules in trx0trx.h */ + /* See state transitions and locking rules in trx0trx.h */ - if (trx_state_eq(trx, TRX_STATE_NOT_STARTED)) { + if (trx_state_eq(trx, TRX_STATE_NOT_STARTED)) { - fputs("---", m_file); - trx_print_latched(m_file, trx, 600); - } + fputs("---", file); + trx_print_latched(file, trx, 600); + } else { + started.insert(trx); } - - FILE* m_file; -}; +} /** Iterate over a transaction's locks. Keeping track of the iterator using an ordinal value. */ @@ -5287,8 +5285,11 @@ lock_print_info_all_transactions( transactions will be omitted here. The information will be available from INFORMATION_SCHEMA.INNODB_TRX. */ - PrintNotStarted print_not_started(file); - ut_list_map(trx_sys->mysql_trx_list, print_not_started); + std::set<const trx_t*> not_printed_transactions; + for (const trx_t* trx = UT_LIST_GET_FIRST(trx_sys->mysql_trx_list); + trx; trx = UT_LIST_GET_NEXT(mysql_trx_list, trx)) { + print_not_started(trx, file, not_printed_transactions); + } const trx_t* trx; TrxListIterator trx_iter; @@ -5302,6 +5303,8 @@ lock_print_info_all_transactions( check_trx_state(trx); + not_printed_transactions.erase(trx); + if (trx != prev_trx) { lock_trx_print_wait_and_mvcc_state(file, trx); prev_trx = trx; @@ -5342,6 +5345,14 @@ lock_print_info_all_transactions( trx_iter.next(); } + for (std::set<const trx_t*>::const_iterator it + = not_printed_transactions.begin(), + end = not_printed_transactions.end(); + it != end; ++it) { + fputs("---", file); + trx_print_latched(file, *it, 600); + } + lock_mutex_exit(); mutex_exit(&trx_sys->mutex); |