Commit 60e995cf authored by Jan Lindström's avatar Jan Lindström

MDEV-6930: Make innodb_max_dirty_pages_pct my.cnf variable a double

Merged Facebook commit ecff018632c6db49bad73d9233c3cdc9f41430e9
authored by Steaphan Greene from https://github.com/facebook/mysql-5.6

This change is to fix: http://bugs.mysql.com/62534

This makes innodb_max_dirty_pages_pct a double with min,default,max values
0.001, 75, 99.999.

This also makes innodb_max_dirty_pages_pct_lwm and adaptive_flushing_lwm
doubles, as these sysvars are inter-dependent.

Added more to the BUFFER POOL AND MEMORY section of SHOW INNODB STATUS:
Percent pages dirty: X.X
This is all n_dirty_pages / used_pages
Percent all pages dirty: X.X
This is all n_dirty_pages / all-pages
Max dirty pages percent: X.X
This is innodb_max_dirty_pages_pct

Also changed all of buf from 2 to 3 digits of precision (%.2f -> %.3f).
parent cff0012d
......@@ -7,55 +7,55 @@ SET @@global.innodb_adaptive_flushing_lwm = 1;
SET @@global.innodb_adaptive_flushing_lwm = DEFAULT;
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
10
10.000000
'#---------------------FN_DYNVARS_046_02-------------------------#'
SET innodb_adaptive_flushing_lwm = 1;
ERROR HY000: Variable 'innodb_adaptive_flushing_lwm' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@innodb_adaptive_flushing_lwm;
@@innodb_adaptive_flushing_lwm
10
10.000000
SELECT local.innodb_adaptive_flushing_lwm;
ERROR 42S02: Unknown table 'local' in field list
SET global innodb_adaptive_flushing_lwm = 1;
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
1
1.000000
'#--------------------FN_DYNVARS_046_03------------------------#'
SET @@global.innodb_adaptive_flushing_lwm = 1;
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
1
1.000000
SET @@global.innodb_adaptive_flushing_lwm = 60;
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
60
60.000000
SET @@global.innodb_adaptive_flushing_lwm = 70;
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
70
70.000000
'#--------------------FN_DYNVARS_046_04-------------------------#'
SET @@global.innodb_adaptive_flushing_lwm = -1;
Warnings:
Warning 1292 Truncated incorrect innodb_adaptive_flushing_lwm value: '-1'
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
0
0.000000
SET @@global.innodb_adaptive_flushing_lwm = "T";
ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm'
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
0
0.000000
SET @@global.innodb_adaptive_flushing_lwm = "Y";
ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm'
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
0
0.000000
SET @@global.innodb_adaptive_flushing_lwm = 71;
Warnings:
Warning 1292 Truncated incorrect innodb_adaptive_flushing_lwm value: '71'
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
70
70.000000
'#----------------------FN_DYNVARS_046_05------------------------#'
SELECT @@global.innodb_adaptive_flushing_lwm =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
......@@ -65,32 +65,32 @@ VARIABLE_VALUE
1
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
70
70.000000
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_adaptive_flushing_lwm';
VARIABLE_VALUE
70
70.000000
'#---------------------FN_DYNVARS_046_06-------------------------#'
SET @@global.innodb_adaptive_flushing_lwm = OFF;
ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm'
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
70
70.000000
SET @@global.innodb_adaptive_flushing_lwm = ON;
ERROR 42000: Incorrect argument type to variable 'innodb_adaptive_flushing_lwm'
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
70
70.000000
'#---------------------FN_DYNVARS_046_07----------------------#'
SET @@global.innodb_adaptive_flushing_lwm = TRUE;
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
1
1.000000
SET @@global.innodb_adaptive_flushing_lwm = FALSE;
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
0
0.000000
SET @@global.innodb_adaptive_flushing_lwm = @global_start_value;
SELECT @@global.innodb_adaptive_flushing_lwm;
@@global.innodb_adaptive_flushing_lwm
10
10.000000
......@@ -4,58 +4,64 @@ SELECT @global_start_value;
75
'#--------------------FN_DYNVARS_046_01------------------------#'
SET @@global.innodb_max_dirty_pages_pct = 0;
SET @@global.innodb_max_dirty_pages_pct = DEFAULT;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0'
SET @@global.innodb_max_dirty_pages_pct = @global_start_value;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
75
75.000000
'#---------------------FN_DYNVARS_046_02-------------------------#'
SET innodb_max_dirty_pages_pct = 1;
ERROR HY000: Variable 'innodb_max_dirty_pages_pct' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@innodb_max_dirty_pages_pct;
@@innodb_max_dirty_pages_pct
75
75.000000
SELECT local.innodb_max_dirty_pages_pct;
ERROR 42S02: Unknown table 'local' in field list
SET global innodb_max_dirty_pages_pct = 0;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0
0.001000
'#--------------------FN_DYNVARS_046_03------------------------#'
SET @@global.innodb_max_dirty_pages_pct = 0;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0
0.001000
SET @@global.innodb_max_dirty_pages_pct = 1;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
1
1.000000
SET @@global.innodb_max_dirty_pages_pct = 99;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99
99.000000
'#--------------------FN_DYNVARS_046_04-------------------------#'
SET @@global.innodb_max_dirty_pages_pct = -1;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '-1'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0
0.001000
SET @@global.innodb_max_dirty_pages_pct = "T";
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0
0.001000
SET @@global.innodb_max_dirty_pages_pct = "Y";
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0
0.001000
SET @@global.innodb_max_dirty_pages_pct = 1001;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '1001'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99
99.999000
'#----------------------FN_DYNVARS_046_05------------------------#'
SELECT @@global.innodb_max_dirty_pages_pct =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
......@@ -65,32 +71,34 @@ VARIABLE_VALUE
1
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99
99.999000
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct';
VARIABLE_VALUE
99
99.999000
'#---------------------FN_DYNVARS_046_06-------------------------#'
SET @@global.innodb_max_dirty_pages_pct = OFF;
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99
99.999000
SET @@global.innodb_max_dirty_pages_pct = ON;
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
99
99.999000
'#---------------------FN_DYNVARS_046_07----------------------#'
SET @@global.innodb_max_dirty_pages_pct = TRUE;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
1
1.000000
SET @@global.innodb_max_dirty_pages_pct = FALSE;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct value: '0'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
0
0.001000
SET @@global.innodb_max_dirty_pages_pct = @global_start_value;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
75
75.000000
......@@ -5,13 +5,13 @@ SET @@global.innodb_max_dirty_pages_pct = 80;
'connection con1'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
80
80.000000
SET @@global.innodb_max_dirty_pages_pct = 70;
'connect (con2,localhost,root,,,,)'
'connection con2'
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
70
70.000000
'connection default'
'disconnect con2'
'disconnect con1'
......
SET @pct_lwm_start_value = @@global.innodb_max_dirty_pages_pct_lwm;
SELECT @pct_lwm_start_value;
@pct_lwm_start_value
0
0.001
SET @pct_start_value = @@global.innodb_max_dirty_pages_pct;
SELECT @pct_start_value;
@pct_start_value
75
'#--------------------FN_DYNVARS_046_01------------------------#'
SET @@global.innodb_max_dirty_pages_pct_lwm = 0;
SET @@global.innodb_max_dirty_pages_pct_lwm = DEFAULT;
SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_lwm_start_value;
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
0
0.001000
'#---------------------FN_DYNVARS_046_02-------------------------#'
SET innodb_max_dirty_pages_pct_lwm = 1;
ERROR HY000: Variable 'innodb_max_dirty_pages_pct_lwm' is a GLOBAL variable and should be set with SET GLOBAL
SELECT @@innodb_max_dirty_pages_pct_lwm;
@@innodb_max_dirty_pages_pct_lwm
0
0.001000
SELECT local.innodb_max_dirty_pages_pct_lwm;
ERROR 42S02: Unknown table 'local' in field list
SET global innodb_max_dirty_pages_pct_lwm = 0;
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
0
0.000000
'#--------------------FN_DYNVARS_046_03------------------------#'
SET @@global.innodb_max_dirty_pages_pct_lwm = 0;
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
0
0.000000
SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_start_value;
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
75
75.000000
'#--------------------FN_DYNVARS_046_04-------------------------#'
SET @@global.innodb_max_dirty_pages_pct_lwm = -1;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct_lwm value: '-1'
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
0
0.000000
SET @@global.innodb_max_dirty_pages_pct_lwm = "T";
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm'
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
0
0.000000
SET @@global.innodb_max_dirty_pages_pct_lwm = "Y";
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm'
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
0
0.000000
SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_start_value + 1;
Warnings:
Warning 1210 innodb_max_dirty_pages_pct_lwm cannot be set higher than innodb_max_dirty_pages_pct.
Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75
Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75.000000
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
75
75.000000
SET @@global.innodb_max_dirty_pages_pct_lwm = 100;
Warnings:
Warning 1292 Truncated incorrect innodb_max_dirty_pages_pct_lwm value: '100'
Warning 1210 innodb_max_dirty_pages_pct_lwm cannot be set higher than innodb_max_dirty_pages_pct.
Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75
Warning 1210 Setting innodb_max_dirty_page_pct_lwm to 75.000000
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
75
75.000000
'#----------------------FN_DYNVARS_046_05------------------------#'
SELECT @@global.innodb_max_dirty_pages_pct_lwm =
VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
......@@ -74,36 +74,36 @@ VARIABLE_VALUE
1
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
75
75.000000
SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='innodb_max_dirty_pages_pct_lwm';
VARIABLE_VALUE
75
75.000000
'#---------------------FN_DYNVARS_046_06-------------------------#'
SET @@global.innodb_max_dirty_pages_pct_lwm = OFF;
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm'
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
75
75.000000
SET @@global.innodb_max_dirty_pages_pct_lwm = ON;
ERROR 42000: Incorrect argument type to variable 'innodb_max_dirty_pages_pct_lwm'
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
75
75.000000
'#---------------------FN_DYNVARS_046_07----------------------#'
SET @@global.innodb_max_dirty_pages_pct_lwm = TRUE;
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
1
1.000000
SET @@global.innodb_max_dirty_pages_pct_lwm = FALSE;
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
0
0.000000
SET @@global.innodb_max_dirty_pages_pct = @pct_start_value;
SELECT @@global.innodb_max_dirty_pages_pct;
@@global.innodb_max_dirty_pages_pct
75
75.000000
SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_lwm_start_value;
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
@@global.innodb_max_dirty_pages_pct_lwm
0
0.001000
......@@ -44,7 +44,7 @@ SELECT @global_start_value;
########################################################################
SET @@global.innodb_max_dirty_pages_pct = 0;
SET @@global.innodb_max_dirty_pages_pct = DEFAULT;
SET @@global.innodb_max_dirty_pages_pct = @global_start_value;
SELECT @@global.innodb_max_dirty_pages_pct;
--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
......
......@@ -47,7 +47,7 @@ SELECT @pct_start_value;
########################################################################
SET @@global.innodb_max_dirty_pages_pct_lwm = 0;
SET @@global.innodb_max_dirty_pages_pct_lwm = DEFAULT;
SET @@global.innodb_max_dirty_pages_pct_lwm = @pct_lwm_start_value;
SELECT @@global.innodb_max_dirty_pages_pct_lwm;
--echo '#---------------------FN_DYNVARS_046_02-------------------------#'
......
......@@ -4937,22 +4937,22 @@ Returns the ratio in percents of modified pages in the buffer pool /
database pages in the buffer pool.
@return modified page percentage ratio */
UNIV_INTERN
ulint
double
buf_get_modified_ratio_pct(void)
/*============================*/
{
ulint ratio;
double percentage = 0.0;
ulint lru_len = 0;
ulint free_len = 0;
ulint flush_list_len = 0;
buf_get_total_list_len(&lru_len, &free_len, &flush_list_len);
ratio = (100 * flush_list_len) / (1 + lru_len + free_len);
percentage = (100.0 * flush_list_len) / (1.0 + lru_len + free_len);
/* 1 + is there to avoid division by zero */
return(ratio);
return(percentage);
}
/*******************************************************************//**
......@@ -5165,6 +5165,8 @@ buf_print_io_instance(
"Database pages %lu\n"
"Old database pages %lu\n"
"Modified db pages %lu\n"
"Percent of dirty pages(LRU & free pages): %.3f\n"
"Max dirty pages percent: %.3f\n"
"Pending reads %lu\n"
"Pending writes: LRU %lu, flush list %lu, single page %lu\n",
pool_info->pool_size,
......@@ -5172,6 +5174,9 @@ buf_print_io_instance(
pool_info->lru_len,
pool_info->old_lru_len,
pool_info->flush_list_len,
(((double) pool_info->flush_list_len) /
(pool_info->lru_len + pool_info->free_list_len + 1.0)) * 100.0,
srv_max_buf_pool_modified_pct,
pool_info->n_pend_reads,
pool_info->n_pending_flush_lru,
pool_info->n_pending_flush_list,
......
......@@ -3115,7 +3115,7 @@ innobase_change_buffering_inited_ok:
" cannot be set higher than"
" innodb_max_dirty_pages_pct.\n"
"InnoDB: Setting"
" innodb_max_dirty_pages_pct_lwm to %lu\n",
" innodb_max_dirty_pages_pct_lwm to %lf\n",
srv_max_buf_pool_modified_pct);
srv_max_dirty_pages_pct_lwm = srv_max_buf_pool_modified_pct;
......@@ -14275,7 +14275,7 @@ innodb_max_dirty_pages_pct_update(
const void* save) /*!< in: immediate result
from check function */
{
ulong in_val = *static_cast<const ulong*>(save);
double in_val = *static_cast<const double*>(save);
if (in_val < srv_max_dirty_pages_pct_lwm) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_ARGUMENTS,
......@@ -14285,7 +14285,7 @@ innodb_max_dirty_pages_pct_update(
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_ARGUMENTS,
"Lowering"
" innodb_max_dirty_page_pct_lwm to %lu",
" innodb_max_dirty_page_pct_lwm to %lf",
in_val);
srv_max_dirty_pages_pct_lwm = in_val;
......@@ -14309,7 +14309,7 @@ innodb_max_dirty_pages_pct_lwm_update(
const void* save) /*!< in: immediate result
from check function */
{
ulong in_val = *static_cast<const ulong*>(save);
double in_val = *static_cast<const double*>(save);
if (in_val > srv_max_buf_pool_modified_pct) {
in_val = srv_max_buf_pool_modified_pct;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
......@@ -14320,7 +14320,7 @@ innodb_max_dirty_pages_pct_lwm_update(
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_ARGUMENTS,
"Setting innodb_max_dirty_page_pct_lwm"
" to %lu",
" to %lf",
in_val);
}
......@@ -16247,22 +16247,22 @@ static MYSQL_SYSVAR_STR(log_group_home_dir, srv_log_group_home_dir,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Path to InnoDB log files.", NULL, NULL, NULL);
static MYSQL_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
static MYSQL_SYSVAR_DOUBLE(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
PLUGIN_VAR_RQCMDARG,
"Percentage of dirty pages allowed in bufferpool.",
NULL, innodb_max_dirty_pages_pct_update, 75, 0, 99, 0);
NULL, innodb_max_dirty_pages_pct_update, 75.0, 0.001, 99.999, 0);
static MYSQL_SYSVAR_ULONG(max_dirty_pages_pct_lwm,
static MYSQL_SYSVAR_DOUBLE(max_dirty_pages_pct_lwm,
srv_max_dirty_pages_pct_lwm,
PLUGIN_VAR_RQCMDARG,
"Percentage of dirty pages at which flushing kicks in.",
NULL, innodb_max_dirty_pages_pct_lwm_update, 0, 0, 99, 0);
NULL, innodb_max_dirty_pages_pct_lwm_update, 0.001, 0.000, 99.999, 0);
static MYSQL_SYSVAR_ULONG(adaptive_flushing_lwm,
static MYSQL_SYSVAR_DOUBLE(adaptive_flushing_lwm,
srv_adaptive_flushing_lwm,
PLUGIN_VAR_RQCMDARG,
"Percentage of log capacity below which no adaptive flushing happens.",
NULL, NULL, 10, 0, 70, 0);
NULL, NULL, 10.0, 0.0, 70.0, 0);
static MYSQL_SYSVAR_BOOL(adaptive_flushing, srv_adaptive_flushing,
PLUGIN_VAR_NOCMDARG,
......
......@@ -794,7 +794,7 @@ Returns the ratio in percents of modified pages in the buffer pool /
database pages in the buffer pool.
@return modified page percentage ratio */
UNIV_INTERN
ulint
double
buf_get_modified_ratio_pct(void);
/*============================*/
/**********************************************************************//**
......
......@@ -320,10 +320,10 @@ extern ulint srv_win_file_flush_method;
extern ulint srv_max_n_open_files;
extern ulong srv_max_dirty_pages_pct;
extern ulong srv_max_dirty_pages_pct_lwm;
extern double srv_max_dirty_pages_pct;
extern double srv_max_dirty_pages_pct_lwm;
extern ulong srv_adaptive_flushing_lwm;
extern double srv_adaptive_flushing_lwm;
extern ulong srv_flushing_avg_loops;
extern ulong srv_force_recovery;
......@@ -354,7 +354,7 @@ extern ibool srv_use_atomic_writes;
extern ibool srv_use_posix_fallocate;
#endif
extern ulong srv_max_buf_pool_modified_pct;
extern double srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag;
extern ulong srv_max_purge_lag_delay;
......
......@@ -276,12 +276,12 @@ in the buffer pool to all database pages in the buffer pool smaller than
the following number. But it is not guaranteed that the value stays below
that during a time of heavy update/insert activity. */
UNIV_INTERN ulong srv_max_buf_pool_modified_pct = 75;
UNIV_INTERN ulong srv_max_dirty_pages_pct_lwm = 50;
UNIV_INTERN double srv_max_buf_pool_modified_pct = 75.0;
UNIV_INTERN double srv_max_dirty_pages_pct_lwm = 50.0;
/* This is the percentage of log capacity at which adaptive flushing,
if enabled, will kick in. */
UNIV_INTERN ulong srv_adaptive_flushing_lwm = 10;
UNIV_INTERN double srv_adaptive_flushing_lwm = 10.0;
/* Number of iterations over which adaptive flushing is averaged. */
UNIV_INTERN ulong srv_flushing_avg_loops = 30;
......
......@@ -5203,22 +5203,22 @@ Returns the ratio in percents of modified pages in the buffer pool /
database pages in the buffer pool.
@return modified page percentage ratio */
UNIV_INTERN
ulint
double
buf_get_modified_ratio_pct(void)
/*============================*/
{
ulint ratio;
double percentage = 0.0;
ulint lru_len = 0;
ulint free_len = 0;
ulint flush_list_len = 0;
buf_get_total_list_len(&lru_len, &free_len, &flush_list_len);
ratio = (100 * flush_list_len) / (1 + lru_len + free_len);
percentage = (100.0 * flush_list_len) / (1.0 + lru_len + free_len);
/* 1 + is there to avoid division by zero */
return(ratio);
return(percentage);
}
/*******************************************************************//**
......@@ -5434,6 +5434,8 @@ buf_print_io_instance(
"Database pages %lu\n"
"Old database pages %lu\n"
"Modified db pages %lu\n"
"Percent of dirty pages(LRU & free pages): %.3f\n"
"Max dirty pages percent: %.3f\n"
"Pending reads %lu\n"
"Pending writes: LRU %lu, flush list %lu, single page %lu\n",
pool_info->pool_size,
......@@ -5442,6 +5444,9 @@ buf_print_io_instance(
pool_info->lru_len,
pool_info->old_lru_len,
pool_info->flush_list_len,
(((double) pool_info->flush_list_len) /
(pool_info->lru_len + pool_info->free_list_len + 1.0)) * 100.0,
srv_max_buf_pool_modified_pct,
pool_info->n_pend_reads,
pool_info->n_pending_flush_lru,
pool_info->n_pending_flush_list,
......
......@@ -3517,7 +3517,7 @@ innobase_change_buffering_inited_ok:
" cannot be set higher than"
" innodb_max_dirty_pages_pct.\n"
"InnoDB: Setting"
" innodb_max_dirty_pages_pct_lwm to %lu\n",
" innodb_max_dirty_pages_pct_lwm to %lf\n",
srv_max_buf_pool_modified_pct);
srv_max_dirty_pages_pct_lwm = srv_max_buf_pool_modified_pct;
......@@ -15051,7 +15051,7 @@ innodb_max_dirty_pages_pct_update(
const void* save) /*!< in: immediate result
from check function */
{
ulong in_val = *static_cast<const ulong*>(save);
double in_val = *static_cast<const double*>(save);
if (in_val < srv_max_dirty_pages_pct_lwm) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_ARGUMENTS,
......@@ -15061,7 +15061,7 @@ innodb_max_dirty_pages_pct_update(
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_ARGUMENTS,
"Lowering"
" innodb_max_dirty_page_pct_lwm to %lu",
" innodb_max_dirty_page_pct_lwm to %lf",
in_val);
srv_max_dirty_pages_pct_lwm = in_val;
......@@ -15085,7 +15085,7 @@ innodb_max_dirty_pages_pct_lwm_update(
const void* save) /*!< in: immediate result
from check function */
{
ulong in_val = *static_cast<const ulong*>(save);
double in_val = *static_cast<const double*>(save);
if (in_val > srv_max_buf_pool_modified_pct) {
in_val = srv_max_buf_pool_modified_pct;
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
......@@ -15096,7 +15096,7 @@ innodb_max_dirty_pages_pct_lwm_update(
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_WRONG_ARGUMENTS,
"Setting innodb_max_dirty_page_pct_lwm"
" to %lu",
" to %lf",
in_val);
}
......@@ -17338,22 +17338,22 @@ static MYSQL_SYSVAR_ULONG(log_arch_expire_sec,
"Expiration time for archived innodb transaction logs.",
NULL, innodb_log_archive_expire_update, 0, 0, ~0UL, 0);
static MYSQL_SYSVAR_ULONG(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
static MYSQL_SYSVAR_DOUBLE(max_dirty_pages_pct, srv_max_buf_pool_modified_pct,
PLUGIN_VAR_RQCMDARG,
"Percentage of dirty pages allowed in bufferpool.",
NULL, innodb_max_dirty_pages_pct_update, 75, 0, 99, 0);
NULL, innodb_max_dirty_pages_pct_update, 75.0, 0.001, 99.999, 0);
static MYSQL_SYSVAR_ULONG(max_dirty_pages_pct_lwm,
static MYSQL_SYSVAR_DOUBLE(max_dirty_pages_pct_lwm,
srv_max_dirty_pages_pct_lwm,
PLUGIN_VAR_RQCMDARG,
"Percentage of dirty pages at which flushing kicks in.",
NULL, innodb_max_dirty_pages_pct_lwm_update, 0, 0, 99, 0);
NULL, innodb_max_dirty_pages_pct_lwm_update, 0.001, 0.000, 99.999, 0);
static MYSQL_SYSVAR_ULONG(adaptive_flushing_lwm,
static MYSQL_SYSVAR_DOUBLE(adaptive_flushing_lwm,
srv_adaptive_flushing_lwm,
PLUGIN_VAR_RQCMDARG,
"Percentage of log capacity below which no adaptive flushing happens.",
NULL, NULL, 10, 0, 70, 0);
NULL, NULL, 10.0, 0.0, 70.0, 0);
static MYSQL_SYSVAR_BOOL(adaptive_flushing, srv_adaptive_flushing,
PLUGIN_VAR_NOCMDARG,
......
......@@ -792,7 +792,7 @@ Returns the ratio in percents of modified pages in the buffer pool /
database pages in the buffer pool.
@return modified page percentage ratio */
UNIV_INTERN
ulint
double
buf_get_modified_ratio_pct(void);
/*============================*/
/**********************************************************************//**
......
......@@ -388,10 +388,10 @@ extern ulint srv_win_file_flush_method;
extern ulint srv_max_n_open_files;
extern ulong srv_max_dirty_pages_pct;
extern ulong srv_max_dirty_pages_pct_lwm;
extern double srv_max_dirty_pages_pct;
extern double srv_max_dirty_pages_pct_lwm;
extern ulong srv_adaptive_flushing_lwm;
extern double srv_adaptive_flushing_lwm;
extern ulong srv_flushing_avg_loops;
extern ulong srv_force_recovery;
......@@ -423,7 +423,7 @@ extern ulong srv_checksum_algorithm;
extern ulong srv_log_arch_expire_sec;
extern ulong srv_max_buf_pool_modified_pct;
extern double srv_max_buf_pool_modified_pct;
extern ulong srv_max_purge_lag;
extern ulong srv_max_purge_lag_delay;
......
......@@ -347,12 +347,12 @@ in the buffer pool to all database pages in the buffer pool smaller than
the following number. But it is not guaranteed that the value stays below
that during a time of heavy update/insert activity. */
UNIV_INTERN ulong srv_max_buf_pool_modified_pct = 75;
UNIV_INTERN ulong srv_max_dirty_pages_pct_lwm = 50;
UNIV_INTERN double srv_max_buf_pool_modified_pct = 75.0;
UNIV_INTERN double srv_max_dirty_pages_pct_lwm = 50.0;
/* This is the percentage of log capacity at which adaptive flushing,
if enabled, will kick in. */
UNIV_INTERN ulong srv_adaptive_flushing_lwm = 10;
UNIV_INTERN double srv_adaptive_flushing_lwm = 10.0;
/* Number of iterations over which adaptive flushing is averaged. */
UNIV_INTERN ulong srv_flushing_avg_loops = 30;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment