From 0b612619efb57734c2e1d10452ca25f24267fc69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 8 Jan 2024 14:36:54 +0200 Subject: [PATCH] MDEV-33098: Fix some instrumentation for innodb.doublewrite_debug buf_flush_page_cleaner(): A continue or break inside DBUG_EXECUTE_IF actually is a no-op. Use an explicit call to _db_keyword_() to actually avoid advancing the checkpoint. buf_flush_list_now_set(): Invoke os_aio_wait_until_no_pending_writes() to ensure that the page write to the system tablespace is completed. --- mysql-test/suite/innodb/t/doublewrite_debug.test | 11 ----------- storage/innobase/buf/buf0flu.cc | 6 +++--- storage/innobase/handler/ha_innodb.cc | 3 +++ 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/mysql-test/suite/innodb/t/doublewrite_debug.test b/mysql-test/suite/innodb/t/doublewrite_debug.test index b8eb81c645c..1bff8b4e07f 100644 --- a/mysql-test/suite/innodb/t/doublewrite_debug.test +++ b/mysql-test/suite/innodb/t/doublewrite_debug.test @@ -61,17 +61,6 @@ set global innodb_fil_make_page_dirty_debug = 0; set global innodb_buf_flush_list_now = 1; --let CLEANUP_IF_CHECKPOINT=drop table t1, unexpected_checkpoint; -# Occasionally, a checkpoint would occur on the MSAN builder. -# We do not know the reason, because the failure can only be reproduced if there is -# enough load in that environment. -# Therefore, we allow the test to be skipped when run on MSAN. -# In other environments, we want the test to fail if a checkpoint occurs, -# so that we would catch it if it starts to happen regularly. -if (`select count(*) from information_schema.system_variables where variable_name='have_sanitizer' and global_value like "MSAN%"`) -{ ---let CLEANUP_IF_CHECKPOINT=drop table t1; -} - --source ../include/no_checkpoint_end.inc --echo # Make the 1st page (page_no=0) and 2nd page (page_no=1) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index c0c743ede57..e181d311a7c 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2333,9 +2333,9 @@ static os_thread_ret_t DECLARE_THREAD(buf_flush_page_cleaner)(void*) do { - DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", continue;); - DBUG_EXECUTE_IF("ib_log_checkpoint_avoid_hard", continue;); - + IF_DBUG(if (_db_keyword_(nullptr, "ib_log_checkpoint_avoid", 1) || + _db_keyword_(nullptr, "ib_log_checkpoint_avoid_hard", 1)) + continue,); if (!recv_recovery_is_on() && !srv_startup_is_before_trx_rollback_phase && srv_operation <= SRV_OPERATION_EXPORT_RESTORED) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 777ea1ba86e..9b4f8b37cb5 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -18313,7 +18313,10 @@ buf_flush_list_now_set(THD*, st_mysql_sys_var*, void*, const void* save) if (s) buf_flush_sync(); else + { while (buf_flush_list_space(fil_system.sys_space, nullptr)); + os_aio_wait_until_no_pending_writes(); + } mysql_mutex_lock(&LOCK_global_system_variables); }