Commit 71f9cc12 authored by Marko Mäkelä's avatar Marko Mäkelä

MDEV-15554 InnoDB page_cleaner shutdown sometimes hangs

buf_flush_page_cleaner_coordinator(): Signal the worker threads
to exit while waiting for them to exit. Apparently, signals are
sometimes lost, causing shutdown to occasionally hang when
multiple page cleaners (and buffer pool instances) are used,
that is, when innodb_buffer_pool_size is at least 1 GiB.

buf_flush_page_cleaner_close(): Merge with the only caller.
parent 9d95b866
......@@ -2718,25 +2718,6 @@ buf_flush_page_cleaner_init(void)
page_cleaner.is_running = true;
}
/**
Close page_cleaner. */
static
void
buf_flush_page_cleaner_close(void)
{
ut_ad(!page_cleaner.is_running);
/* waiting for all worker threads exit */
while (page_cleaner.n_workers) {
os_thread_sleep(10000);
}
mutex_destroy(&page_cleaner.mutex);
os_event_destroy(page_cleaner.is_finished);
os_event_destroy(page_cleaner.is_requested);
}
/**
Requests for all slots to flush all buffer pool instances.
@param min_n wished minimum mumber of blocks flushed
......@@ -3438,9 +3419,17 @@ DECLARE_THREAD(buf_flush_page_cleaner_coordinator)(void*)
and no more access to page_cleaner structure by them.
Wakes worker threads up just to make them exit. */
page_cleaner.is_running = false;
os_event_set(page_cleaner.is_requested);
buf_flush_page_cleaner_close();
/* waiting for all worker threads exit */
while (page_cleaner.n_workers) {
os_event_set(page_cleaner.is_requested);
os_thread_sleep(10000);
}
mutex_destroy(&page_cleaner.mutex);
os_event_destroy(page_cleaner.is_finished);
os_event_destroy(page_cleaner.is_requested);
buf_page_cleaner_is_active = false;
......
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