Commit fb5d5794 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-13987 Hang in FLUSH TABLES...FOR EXPORT

trx_purge_stop(): Release purge_sys->latch before attempting to
wake up the purge threads, so that they can actually wake up.
This is a regression of commit a13a636c
which attempted to fix MDEV-11802 by ensuring that srv_purge_wakeup()
will actually wait until all purge threads wake up.
Due to the purge_sys->latch, the threads might never wake up,
because some purge threads could end up waiting for purge_sys->latch
in trx_undo_prev_version_build() while holding dict_operation_lock
in shared mode. This in turn would block any DDL operations, the
InnoDB master thread, and InnoDB shutdown.
parent 16a8a241
...@@ -2932,6 +2932,7 @@ void ...@@ -2932,6 +2932,7 @@ void
srv_purge_wakeup() srv_purge_wakeup()
{ {
ut_ad(!srv_read_only_mode); ut_ad(!srv_read_only_mode);
ut_ad(!sync_check_iterate(sync_check()));
if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) { if (srv_force_recovery >= SRV_FORCE_NO_BACKGROUND) {
return; return;
......
...@@ -1781,8 +1781,8 @@ trx_purge_stop(void) ...@@ -1781,8 +1781,8 @@ trx_purge_stop(void)
const int64_t sig_count = os_event_reset(purge_sys->event); const int64_t sig_count = os_event_reset(purge_sys->event);
purge_sys->state = PURGE_STATE_STOP; purge_sys->state = PURGE_STATE_STOP;
srv_purge_wakeup();
rw_lock_x_unlock(&purge_sys->latch); rw_lock_x_unlock(&purge_sys->latch);
srv_purge_wakeup();
/* Wait for purge coordinator to signal that it /* Wait for purge coordinator to signal that it
is suspended. */ is suspended. */
os_event_wait_low(purge_sys->event, sig_count); os_event_wait_low(purge_sys->event, sig_count);
......
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