Skip to content
Permalink
Browse files
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.
  • Loading branch information
dr-m committed Mar 13, 2018
1 parent 9d95b86 commit 71f9cc1
Showing 1 changed file with 10 additions and 21 deletions.
@@ -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;

0 comments on commit 71f9cc1

Please sign in to comment.