MDEV-15612 - Latching violation in trx_roll_must_shutdown

recv_sys_t::mutex and rw_trx_hash_elementi_t::mutex were acquired
in reverse (to recorded) order.

Fixed by releasing recv_sys_t::mutex, before iterating rw_trx_hash.
Statistics gathering doesn't really need recv_sys_t::mutex protection,
since it is always done in one thread (trx_roll_crash_recv_trx) and
thus it can't go wrong.
This commit is contained in:
Sergey Vojtovich 2018-03-27 16:05:50 +04:00
commit b36da48ad3

View file

@ -737,8 +737,10 @@ trx_roll_must_shutdown()
ib_time_t time = ut_time();
mutex_enter(&recv_sys->mutex);
bool report = recv_sys->report(time);
mutex_exit(&recv_sys->mutex);
if (recv_sys->report(time)) {
if (report) {
trx_roll_count_callback_arg arg;
/* Get number of recovered active transactions and number of
@ -752,8 +754,6 @@ trx_roll_must_shutdown()
sd_notifyf(0, "STATUS=To roll back: " UINT32PF " transactions,"
" " UINT64PF " rows", arg.n_trx, arg.n_rows);
}
mutex_exit(&recv_sys->mutex);
return false;
}