From f1acd9f14bd054b8d8d576c6fe567226c097132d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 13 Oct 2021 15:16:23 +0300 Subject: [PATCH] MDEV-26819 SET GLOBAL innodb_max_dirty_pages_pct=0 occasionally fails to trigger writes innodb_max_dirty_pages_pct_update(), innodb_max_dirty_pages_pct_lwm_update(): Invoke buf_pool.page_cleaner_wakeup() in order to wake up buf_flush_page_cleaner. This allows the test innodb.page_cleaner to run without any occasional timeouts. The occasional hangs were introduced by commit 7b1252c03d7131754d9503560fe507b33ca1f8b4 (MDEV-24278). --- storage/innobase/buf/buf0flu.cc | 2 +- storage/innobase/handler/ha_innodb.cc | 14 ++++++++++++-- storage/innobase/include/buf0buf.h | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 7bf26515e88b6..c503b97f776cc 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -123,7 +123,7 @@ static void buf_flush_validate_skip() #endif /* UNIV_DEBUG */ /** Wake up the page cleaner if needed */ -inline void buf_pool_t::page_cleaner_wakeup() +void buf_pool_t::page_cleaner_wakeup() { if (!page_cleaner_idle()) return; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index e0f2b020e8944..c2d98906e522e 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -17214,7 +17214,12 @@ innodb_max_dirty_pages_pct_update( } srv_max_buf_pool_modified_pct = in_val; - pthread_cond_signal(&buf_pool.do_flush_list); + + mysql_mutex_unlock(&LOCK_global_system_variables); + mysql_mutex_lock(&buf_pool.flush_list_mutex); + buf_pool.page_cleaner_wakeup(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + mysql_mutex_lock(&LOCK_global_system_variables); } /****************************************************************//** @@ -17245,7 +17250,12 @@ innodb_max_dirty_pages_pct_lwm_update( } srv_max_dirty_pages_pct_lwm = in_val; - pthread_cond_signal(&buf_pool.do_flush_list); + + mysql_mutex_unlock(&LOCK_global_system_variables); + mysql_mutex_lock(&buf_pool.flush_list_mutex); + buf_pool.page_cleaner_wakeup(); + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + mysql_mutex_lock(&LOCK_global_system_variables); } /*************************************************************//** diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index e9cd1f9a205dc..e5e15730253a8 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1935,7 +1935,7 @@ class buf_pool_t return page_cleaner_is_idle; } /** Wake up the page cleaner if needed */ - inline void page_cleaner_wakeup(); + void page_cleaner_wakeup(); /** Register whether an explicit wakeup of the page cleaner is needed */ void page_cleaner_set_idle(bool deep_sleep)