Commit 61f370a3 authored by Eugene Kosov's avatar Eugene Kosov Committed by Marko Mäkelä

MDEV-18429 Consistent non-locking reads do not appear in TRANSACTIONS section...

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.
parent d6e431df
...@@ -4973,28 +4973,26 @@ lock_print_info_summary( ...@@ -4973,28 +4973,26 @@ lock_print_info_summary(
return(TRUE); return(TRUE);
} }
/** Functor to print not-started transaction from the mysql_trx_list. */ /** Prints not started transaction or puts it into set.
@param[in] trx transaction
struct PrintNotStarted { @param[in,out] file fd where to print
@param[in,out] started put transaction here if is started */
PrintNotStarted(FILE* file) : m_file(file) { } static void
print_not_started(const trx_t* trx, FILE* file, std::set<const trx_t*>& started)
void operator()(const trx_t* trx) {
{ ut_ad(trx->in_mysql_trx_list);
ut_ad(trx->in_mysql_trx_list); ut_ad(mutex_own(&trx_sys->mutex));
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); fputs("---", file);
trx_print_latched(m_file, trx, 600); trx_print_latched(file, trx, 600);
} } else {
started.insert(trx);
} }
}
FILE* m_file;
};
/** Iterate over a transaction's locks. Keeping track of the /** Iterate over a transaction's locks. Keeping track of the
iterator using an ordinal value. */ iterator using an ordinal value. */
...@@ -5287,8 +5285,11 @@ lock_print_info_all_transactions( ...@@ -5287,8 +5285,11 @@ lock_print_info_all_transactions(
transactions will be omitted here. The information will be transactions will be omitted here. The information will be
available from INFORMATION_SCHEMA.INNODB_TRX. */ available from INFORMATION_SCHEMA.INNODB_TRX. */
PrintNotStarted print_not_started(file); std::set<const trx_t*> not_printed_transactions;
ut_list_map(trx_sys->mysql_trx_list, print_not_started); 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; const trx_t* trx;
TrxListIterator trx_iter; TrxListIterator trx_iter;
...@@ -5302,6 +5303,8 @@ lock_print_info_all_transactions( ...@@ -5302,6 +5303,8 @@ lock_print_info_all_transactions(
check_trx_state(trx); check_trx_state(trx);
not_printed_transactions.erase(trx);
if (trx != prev_trx) { if (trx != prev_trx) {
lock_trx_print_wait_and_mvcc_state(file, trx); lock_trx_print_wait_and_mvcc_state(file, trx);
prev_trx = trx; prev_trx = trx;
...@@ -5342,6 +5345,14 @@ lock_print_info_all_transactions( ...@@ -5342,6 +5345,14 @@ lock_print_info_all_transactions(
trx_iter.next(); 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(); lock_mutex_exit();
mutex_exit(&trx_sys->mutex); mutex_exit(&trx_sys->mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment