Commit 17529785 authored by Sergey Vojtovich's avatar Sergey Vojtovich

Fix hang in buf_flush_set_page_cleaner_thread_cnt

Running mysqld with innodb-buffer-pool-instances > 1 hangs on startup.

On startup wrong variables was being used to detect number of page cleaner
threads. As a result no threads were actually started. And subsequent code
waits for threads to start forever.

Fixed by using page_cleaner->n_workers, which holds number of page cleaner
threads (0 at startup) instead of srv_n_page_cleaners, which holds number
of requested page cleaner threads (4 by default).
parent 1773116f
...@@ -3487,19 +3487,15 @@ buf_flush_set_page_cleaner_thread_cnt(ulong new_cnt) ...@@ -3487,19 +3487,15 @@ buf_flush_set_page_cleaner_thread_cnt(ulong new_cnt)
{ {
mutex_enter(&page_cleaner->mutex); mutex_enter(&page_cleaner->mutex);
if (new_cnt > srv_n_page_cleaners) { srv_n_page_cleaners = new_cnt;
if (new_cnt > page_cleaner->n_workers) {
/* User has increased the number of page /* User has increased the number of page
cleaner threads. */ cleaner threads. */
uint add = new_cnt - srv_n_page_cleaners; uint add = new_cnt - page_cleaner->n_workers;
srv_n_page_cleaners = new_cnt;
for (uint i = 0; i < add; i++) { for (uint i = 0; i < add; i++) {
os_thread_id_t cleaner_thread_id; os_thread_id_t cleaner_thread_id;
os_thread_create(buf_flush_page_cleaner_worker, NULL, &cleaner_thread_id); os_thread_create(buf_flush_page_cleaner_worker, NULL, &cleaner_thread_id);
} }
} else if (new_cnt < srv_n_page_cleaners) {
/* User has decreased the number of page
cleaner threads. */
srv_n_page_cleaners = new_cnt;
} }
mutex_exit(&page_cleaner->mutex); mutex_exit(&page_cleaner->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