mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
MDEV-8303; Dumping buffer pool noisy in the logs.
Added new dynamic configuration variable innodb_buf_dump_status_frequency to configure how often buffer pool dump status is printed in the logs. A number between [0, 100] that tells how oftern buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed).
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
SET @start_innodb_buf_dump_status_frequency = @@global.innodb_buf_dump_status_frequency;
|
||||
SELECT @start_innodb_buf_dump_status_frequency;
|
||||
@start_innodb_buf_dump_status_frequency
|
||||
0
|
||||
SELECT COUNT(@@global.innodb_buf_dump_status_frequency);
|
||||
COUNT(@@global.innodb_buf_dump_status_frequency)
|
||||
1
|
||||
SET @@global.innodb_buf_dump_status_frequency = 20;
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
@@global.innodb_buf_dump_status_frequency
|
||||
20
|
||||
SET @@global.innodb_buf_dump_status_frequency = 0;
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
@@global.innodb_buf_dump_status_frequency
|
||||
0
|
||||
SET @@global.innodb_buf_dump_status_frequency = 100;
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
@@global.innodb_buf_dump_status_frequency
|
||||
100
|
||||
SET @@global.innodb_buf_dump_status_frequency = -1;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect innodb_buf_dump_status_frequency value: '-1'
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
@@global.innodb_buf_dump_status_frequency
|
||||
0
|
||||
SET @@global.innodb_buf_dump_status_frequency = 101;
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect innodb_buf_dump_status_frequency value: '101'
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
@@global.innodb_buf_dump_status_frequency
|
||||
100
|
||||
SET @@global.innodb_buf_dump_status_frequency = 10.5;
|
||||
ERROR 42000: Incorrect argument type to variable 'innodb_buf_dump_status_frequency'
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
@@global.innodb_buf_dump_status_frequency
|
||||
100
|
||||
SET @@global.innodb_buf_dump_status_frequency = "abc";
|
||||
ERROR 42000: Incorrect argument type to variable 'innodb_buf_dump_status_frequency'
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
@@global.innodb_buf_dump_status_frequency
|
||||
100
|
||||
SET @@global.innodb_buf_dump_status_frequency = @start_innodb_buf_dump_status_frequency;
|
||||
@@ -0,0 +1,39 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/load_sysvars.inc
|
||||
|
||||
SET @start_innodb_buf_dump_status_frequency = @@global.innodb_buf_dump_status_frequency;
|
||||
SELECT @start_innodb_buf_dump_status_frequency;
|
||||
|
||||
SELECT COUNT(@@global.innodb_buf_dump_status_frequency);
|
||||
|
||||
# test valid value
|
||||
SET @@global.innodb_buf_dump_status_frequency = 20;
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
|
||||
# test valid min
|
||||
SET @@global.innodb_buf_dump_status_frequency = 0;
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
|
||||
# test valid max
|
||||
SET @@global.innodb_buf_dump_status_frequency = 100;
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
|
||||
# test invalid value < min
|
||||
SET @@global.innodb_buf_dump_status_frequency = -1;
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
|
||||
# test invalid value > max
|
||||
SET @@global.innodb_buf_dump_status_frequency = 101;
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
|
||||
# test wrong type
|
||||
--Error ER_WRONG_TYPE_FOR_VAR
|
||||
SET @@global.innodb_buf_dump_status_frequency = 10.5;
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
|
||||
--Error ER_WRONG_TYPE_FOR_VAR
|
||||
SET @@global.innodb_buf_dump_status_frequency = "abc";
|
||||
SELECT @@global.innodb_buf_dump_status_frequency;
|
||||
|
||||
SET @@global.innodb_buf_dump_status_frequency = @start_innodb_buf_dump_status_frequency;
|
||||
|
||||
@@ -211,6 +211,8 @@ buf_dump(
|
||||
buf_dump_t* dump;
|
||||
ulint n_pages;
|
||||
ulint j;
|
||||
ulint limit;
|
||||
ulint counter;
|
||||
|
||||
buf_pool = buf_pool_from_array(i);
|
||||
|
||||
@@ -254,6 +256,9 @@ buf_dump(
|
||||
|
||||
buf_pool_mutex_exit(buf_pool);
|
||||
|
||||
limit = (ulint)((double)n_pages * ((double)srv_buf_dump_status_frequency / (double)100));
|
||||
counter = 0;
|
||||
|
||||
for (j = 0; j < n_pages && !SHOULD_QUIT(); j++) {
|
||||
ret = fprintf(f, ULINTPF "," ULINTPF "\n",
|
||||
BUF_DUMP_SPACE(dump[j]),
|
||||
@@ -268,7 +273,14 @@ buf_dump(
|
||||
return;
|
||||
}
|
||||
|
||||
if (j % 128 == 0) {
|
||||
counter++;
|
||||
|
||||
/* Print buffer pool dump status only if
|
||||
srv_buf_dump_status_frequency is > 0 and
|
||||
we have processed that amount of pages. */
|
||||
if (srv_buf_dump_status_frequency &&
|
||||
counter == limit) {
|
||||
counter = 0;
|
||||
buf_dump_status(
|
||||
STATUS_INFO,
|
||||
"Dumping buffer pool "
|
||||
|
||||
@@ -18985,6 +18985,14 @@ static MYSQL_SYSVAR_BOOL(disable_background_merge,
|
||||
NULL, NULL, FALSE);
|
||||
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
|
||||
|
||||
static MYSQL_SYSVAR_ULONG(buf_dump_status_frequency, srv_buf_dump_status_frequency,
|
||||
PLUGIN_VAR_RQCMDARG,
|
||||
"A number between [0, 100] that tells how oftern buffer pool dump status "
|
||||
"in percentages should be printed. E.g. 10 means that buffer pool dump "
|
||||
"status is printed when every 10% of number of buffer pool pages are "
|
||||
"dumped. Default is 0 (only start and end status is printed).",
|
||||
NULL, NULL, 0, 0, 100, 0);
|
||||
|
||||
#ifdef WITH_INNODB_DISALLOW_WRITES
|
||||
/*******************************************************
|
||||
* innobase_disallow_writes variable definition *
|
||||
@@ -19485,6 +19493,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
|
||||
MYSQL_SYSVAR(debug_force_scrubbing),
|
||||
#endif
|
||||
MYSQL_SYSVAR(instrument_semaphores),
|
||||
MYSQL_SYSVAR(buf_dump_status_frequency),
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -563,6 +563,9 @@ extern ulong srv_fatal_semaphore_wait_threshold;
|
||||
/** Enable semaphore request instrumentation */
|
||||
extern my_bool srv_instrument_semaphores;
|
||||
|
||||
/** Buffer pool dump status frequence in percentages */
|
||||
extern ulong srv_buf_dump_status_frequency;
|
||||
|
||||
# ifdef UNIV_PFS_THREAD
|
||||
/* Keys to register InnoDB threads with performance schema */
|
||||
extern mysql_pfs_key_t buf_page_cleaner_thread_key;
|
||||
|
||||
@@ -544,6 +544,9 @@ current_time % 5 != 0. */
|
||||
/** Simulate compression failures. */
|
||||
UNIV_INTERN uint srv_simulate_comp_failures = 0;
|
||||
|
||||
/** Buffer pool dump status frequence in percentages */
|
||||
UNIV_INTERN ulong srv_buf_dump_status_frequency = 0;
|
||||
|
||||
/** Acquire the system_mutex. */
|
||||
#define srv_sys_mutex_enter() do { \
|
||||
mutex_enter(&srv_sys->mutex); \
|
||||
|
||||
@@ -211,6 +211,8 @@ buf_dump(
|
||||
buf_dump_t* dump;
|
||||
ulint n_pages;
|
||||
ulint j;
|
||||
ulint limit;
|
||||
ulint counter;
|
||||
|
||||
buf_pool = buf_pool_from_array(i);
|
||||
|
||||
@@ -254,6 +256,9 @@ buf_dump(
|
||||
|
||||
mutex_exit(&buf_pool->LRU_list_mutex);
|
||||
|
||||
limit = (ulint)((double)n_pages * ((double)srv_buf_dump_status_frequency / (double)100));
|
||||
counter = 0;
|
||||
|
||||
for (j = 0; j < n_pages && !SHOULD_QUIT(); j++) {
|
||||
ret = fprintf(f, ULINTPF "," ULINTPF "\n",
|
||||
BUF_DUMP_SPACE(dump[j]),
|
||||
@@ -268,7 +273,14 @@ buf_dump(
|
||||
return;
|
||||
}
|
||||
|
||||
if (j % 128 == 0) {
|
||||
counter++;
|
||||
|
||||
/* Print buffer pool dump status only if
|
||||
srv_buf_dump_status_frequency is > 0 and
|
||||
we have processed that amount of pages. */
|
||||
if (srv_buf_dump_status_frequency &&
|
||||
counter == limit) {
|
||||
counter = 0;
|
||||
buf_dump_status(
|
||||
STATUS_INFO,
|
||||
"Dumping buffer pool "
|
||||
|
||||
@@ -20151,6 +20151,14 @@ static MYSQL_SYSVAR_BOOL(disable_background_merge,
|
||||
NULL, NULL, FALSE);
|
||||
#endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */
|
||||
|
||||
static MYSQL_SYSVAR_ULONG(buf_dump_status_frequency, srv_buf_dump_status_frequency,
|
||||
PLUGIN_VAR_RQCMDARG,
|
||||
"A number between [0, 100] that tells how oftern buffer pool dump status "
|
||||
"in percentages should be printed. E.g. 10 means that buffer pool dump "
|
||||
"status is printed when every 10% of number of buffer pool pages are "
|
||||
"dumped. Default is 0 (only start and end status is printed).",
|
||||
NULL, NULL, 0, 0, 100, 0);
|
||||
|
||||
#ifdef WITH_INNODB_DISALLOW_WRITES
|
||||
/*******************************************************
|
||||
* innobase_disallow_writes variable definition *
|
||||
@@ -20728,6 +20736,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
|
||||
MYSQL_SYSVAR(debug_force_scrubbing),
|
||||
#endif
|
||||
MYSQL_SYSVAR(instrument_semaphores),
|
||||
MYSQL_SYSVAR(buf_dump_status_frequency),
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
@@ -706,6 +706,9 @@ extern ulong srv_fatal_semaphore_wait_threshold;
|
||||
/** Enable semaphore request instrumentation */
|
||||
extern my_bool srv_instrument_semaphores;
|
||||
|
||||
/** Buffer pool dump status frequence in percentages */
|
||||
extern ulong srv_buf_dump_status_frequency;
|
||||
|
||||
# ifdef UNIV_PFS_THREAD
|
||||
/* Keys to register InnoDB threads with performance schema */
|
||||
extern mysql_pfs_key_t buf_page_cleaner_thread_key;
|
||||
|
||||
@@ -688,6 +688,9 @@ current_time % 5 != 0. */
|
||||
#endif /* MEM_PERIODIC_CHECK */
|
||||
# define SRV_MASTER_DICT_LRU_INTERVAL (47)
|
||||
|
||||
/** Buffer pool dump status frequence in percentages */
|
||||
UNIV_INTERN ulong srv_buf_dump_status_frequency = 0;
|
||||
|
||||
/** Acquire the system_mutex. */
|
||||
#define srv_sys_mutex_enter() do { \
|
||||
mutex_enter(&srv_sys->mutex); \
|
||||
|
||||
Reference in New Issue
Block a user