From ad44e1b964f75f7cb0b78fa27d84ab2fe2931697 Mon Sep 17 00:00:00 2001 From: mariadb-satishkumar Date: Tue, 2 Sep 2025 08:55:37 +0000 Subject: [PATCH] MDEV-36993: Format log for srv_mon_reset_all --- .../suite/innodb/t/innodb-index-online.test | 4 ++++ .../suite/innodb/t/innodb-table-online.test | 4 ++++ mysql-test/suite/innodb/t/monitor.test | 5 +++++ storage/innobase/include/srv0mon.h | 10 +++------- storage/innobase/include/srv0mon.inl | 19 ------------------- storage/innobase/srv/srv0mon.cc | 13 +++++++++++++ 6 files changed, 29 insertions(+), 26 deletions(-) diff --git a/mysql-test/suite/innodb/t/innodb-index-online.test b/mysql-test/suite/innodb/t/innodb-index-online.test index 97ca25b1420..488412e3a32 100644 --- a/mysql-test/suite/innodb/t/innodb-index-online.test +++ b/mysql-test/suite/innodb/t/innodb-index-online.test @@ -4,6 +4,10 @@ --source include/have_debug_sync.inc --source include/no_valgrind_without_big.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Cannot reset all values for monitor counter"); +--enable_query_log + SET GLOBAL innodb_monitor_reset_all=all; --disable_warnings SET GLOBAL innodb_monitor_reset_all=default; diff --git a/mysql-test/suite/innodb/t/innodb-table-online.test b/mysql-test/suite/innodb/t/innodb-table-online.test index 0612866a36c..3ecf1201f72 100644 --- a/mysql-test/suite/innodb/t/innodb-table-online.test +++ b/mysql-test/suite/innodb/t/innodb-table-online.test @@ -4,6 +4,10 @@ --source include/have_debug_sync.inc --source include/have_sequence.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Cannot reset all values for monitor counter"); +--enable_query_log + SET GLOBAL innodb_monitor_reset_all=all; --disable_warnings SET GLOBAL innodb_monitor_reset_all=default; diff --git a/mysql-test/suite/innodb/t/monitor.test b/mysql-test/suite/innodb/t/monitor.test index 69545c9c6fc..39cdc34c3a8 100644 --- a/mysql-test/suite/innodb/t/monitor.test +++ b/mysql-test/suite/innodb/t/monitor.test @@ -5,6 +5,11 @@ # sys_vars.innodb_monitor_enable_basic --source include/have_innodb.inc + +--disable_query_log +call mtr.add_suppression("InnoDB: Cannot reset all values for monitor counter"); +--enable_query_log + select name, if(enabled,'enabled','disabled') status from information_schema.innodb_metrics; diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index 2ed26748ea6..d313cb63716 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -826,13 +826,9 @@ void srv_mon_reset( /*==========*/ monitor_id_t monitor); /*!< in: monitor id*/ -/*************************************************************//** -This function resets all values of a monitor counter */ -UNIV_INLINE -void -srv_mon_reset_all( -/*==============*/ - monitor_id_t monitor); /*!< in: monitor id*/ + +/** This function resets all values of a monitor counter */ +void srv_mon_reset_all(monitor_id_t monitor) noexcept; /*************************************************************//** Turn on monitor counters that are marked as default ON. */ void diff --git a/storage/innobase/include/srv0mon.inl b/storage/innobase/include/srv0mon.inl index 158345b2f8c..f23500b2b1c 100644 --- a/storage/innobase/include/srv0mon.inl +++ b/storage/innobase/include/srv0mon.inl @@ -92,22 +92,3 @@ srv_mon_calc_min_since_start( return(MONITOR_MIN_VALUE_START(monitor)); } - -/*************************************************************//** -This function resets all values of a monitor counter */ -UNIV_INLINE -void -srv_mon_reset_all( -/*==============*/ - monitor_id_t monitor) /*!< in: monitor id */ -{ - /* Do not reset all counter values if monitor is still on. */ - if (MONITOR_IS_ON(monitor)) { - fprintf(stderr, "InnoDB: Cannot reset all values for" - " monitor counter %s while it is on. Please" - " turn it off and retry.\n", - srv_mon_get_name(monitor)); - } else { - MONITOR_RESET_ALL(monitor); - } -} diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index ff646ba1b79..7f185a87776 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -35,6 +35,7 @@ Created 12/9/2009 Jimmy Yang #include "srv0srv.h" #include "trx0rseg.h" #include "trx0sys.h" +#include "log.h" /* Macro to standardize the counter names for counters in the "monitor_buf_page" module as they have very structured defines */ @@ -1271,6 +1272,18 @@ srv_mon_set_module_control( } } +/** Reset all values. +@param monitor monitor identifier */ +void srv_mon_reset_all(monitor_id_t monitor) noexcept +{ + if (MONITOR_IS_ON(monitor)) + sql_print_warning("InnoDB: Cannot reset all values for monitor counter '%s' " + "while it is on. Please turn it off and retry.", + srv_mon_get_name(monitor)); + else + MONITOR_RESET_ALL(monitor); +} + /****************************************************************//** Get transaction system's rollback segment size in pages @return size in pages */