Skip to content

Commit ad44e1b

Browse files
MDEV-36993: Format log for srv_mon_reset_all
1 parent a1da655 commit ad44e1b

File tree

6 files changed

+29
-26
lines changed

6 files changed

+29
-26
lines changed

mysql-test/suite/innodb/t/innodb-index-online.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
--source include/have_debug_sync.inc
55
--source include/no_valgrind_without_big.inc
66

7+
--disable_query_log
8+
call mtr.add_suppression("InnoDB: Cannot reset all values for monitor counter");
9+
--enable_query_log
10+
711
SET GLOBAL innodb_monitor_reset_all=all;
812
--disable_warnings
913
SET GLOBAL innodb_monitor_reset_all=default;

mysql-test/suite/innodb/t/innodb-table-online.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
--source include/have_debug_sync.inc
55
--source include/have_sequence.inc
66

7+
--disable_query_log
8+
call mtr.add_suppression("InnoDB: Cannot reset all values for monitor counter");
9+
--enable_query_log
10+
711
SET GLOBAL innodb_monitor_reset_all=all;
812
--disable_warnings
913
SET GLOBAL innodb_monitor_reset_all=default;

mysql-test/suite/innodb/t/monitor.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
# sys_vars.innodb_monitor_enable_basic
66

77
--source include/have_innodb.inc
8+
9+
--disable_query_log
10+
call mtr.add_suppression("InnoDB: Cannot reset all values for monitor counter");
11+
--enable_query_log
12+
813
select name, if(enabled,'enabled','disabled') status
914
from information_schema.innodb_metrics;
1015

storage/innobase/include/srv0mon.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -826,13 +826,9 @@ void
826826
srv_mon_reset(
827827
/*==========*/
828828
monitor_id_t monitor); /*!< in: monitor id*/
829-
/*************************************************************//**
830-
This function resets all values of a monitor counter */
831-
UNIV_INLINE
832-
void
833-
srv_mon_reset_all(
834-
/*==============*/
835-
monitor_id_t monitor); /*!< in: monitor id*/
829+
830+
/** This function resets all values of a monitor counter */
831+
void srv_mon_reset_all(monitor_id_t monitor) noexcept;
836832
/*************************************************************//**
837833
Turn on monitor counters that are marked as default ON. */
838834
void

storage/innobase/include/srv0mon.inl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -92,22 +92,3 @@ srv_mon_calc_min_since_start(
9292

9393
return(MONITOR_MIN_VALUE_START(monitor));
9494
}
95-
96-
/*************************************************************//**
97-
This function resets all values of a monitor counter */
98-
UNIV_INLINE
99-
void
100-
srv_mon_reset_all(
101-
/*==============*/
102-
monitor_id_t monitor) /*!< in: monitor id */
103-
{
104-
/* Do not reset all counter values if monitor is still on. */
105-
if (MONITOR_IS_ON(monitor)) {
106-
fprintf(stderr, "InnoDB: Cannot reset all values for"
107-
" monitor counter %s while it is on. Please"
108-
" turn it off and retry.\n",
109-
srv_mon_get_name(monitor));
110-
} else {
111-
MONITOR_RESET_ALL(monitor);
112-
}
113-
}

storage/innobase/srv/srv0mon.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Created 12/9/2009 Jimmy Yang
3535
#include "srv0srv.h"
3636
#include "trx0rseg.h"
3737
#include "trx0sys.h"
38+
#include "log.h"
3839

3940
/* Macro to standardize the counter names for counters in the
4041
"monitor_buf_page" module as they have very structured defines */
@@ -1271,6 +1272,18 @@ srv_mon_set_module_control(
12711272
}
12721273
}
12731274

1275+
/** Reset all values.
1276+
@param monitor monitor identifier */
1277+
void srv_mon_reset_all(monitor_id_t monitor) noexcept
1278+
{
1279+
if (MONITOR_IS_ON(monitor))
1280+
sql_print_warning("InnoDB: Cannot reset all values for monitor counter '%s' "
1281+
"while it is on. Please turn it off and retry.",
1282+
srv_mon_get_name(monitor));
1283+
else
1284+
MONITOR_RESET_ALL(monitor);
1285+
}
1286+
12741287
/****************************************************************//**
12751288
Get transaction system's rollback segment size in pages
12761289
@return size in pages */

0 commit comments

Comments
 (0)