Skip to content

Commit

Permalink
Fix hang in buf_flush_set_page_cleaner_thread_cnt
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
svoj committed Nov 24, 2017
1 parent 1773116 commit 1752978
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions storage/innobase/buf/buf0flu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3487,19 +3487,15 @@ buf_flush_set_page_cleaner_thread_cnt(ulong new_cnt)
{
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
cleaner threads. */
uint add = new_cnt - srv_n_page_cleaners;
srv_n_page_cleaners = new_cnt;
uint add = new_cnt - page_cleaner->n_workers;
for (uint i = 0; i < add; i++) {
os_thread_id_t 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);
Expand Down

0 comments on commit 1752978

Please sign in to comment.