Commit db469b69 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-17475: Increase maximum possible value for table_definition_cache to match table_open_cache

Allow table definition cache be bigger than open table cache (due to problem with VIEWs and prepared statements).
parent 12f362c3
...@@ -28,14 +28,14 @@ Warning 1292 Truncated incorrect table_definition_cache value: '2' ...@@ -28,14 +28,14 @@ Warning 1292 Truncated incorrect table_definition_cache value: '2'
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
400 400
SET @@global.table_definition_cache = 524287; SET @@global.table_definition_cache = 2097151;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
524287 2097151
SET @@global.table_definition_cache = 524288; SET @@global.table_definition_cache = 2097152;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
524288 2097152
'#--------------------FN_DYNVARS_019_04-------------------------#' '#--------------------FN_DYNVARS_019_04-------------------------#'
SET @@global.table_definition_cache = 0; SET @@global.table_definition_cache = 0;
Warnings: Warnings:
...@@ -49,18 +49,18 @@ Warning 1292 Truncated incorrect table_definition_cache value: '-1024' ...@@ -49,18 +49,18 @@ Warning 1292 Truncated incorrect table_definition_cache value: '-1024'
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
400 400
SET @@global.table_definition_cache = 524289; SET @@global.table_definition_cache = 2097153;
Warnings: Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '524289' Warning 1292 Truncated incorrect table_definition_cache value: '2097153'
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
524288 2097152
SET @@global.table_definition_cache = 42949672950; SET @@global.table_definition_cache = 42949672950;
Warnings: Warnings:
Warning 1292 Truncated incorrect table_definition_cache value: '42949672950' Warning 1292 Truncated incorrect table_definition_cache value: '42949672950'
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
@@global.table_definition_cache @@global.table_definition_cache
524288 2097152
SET @@global.table_definition_cache = 21221204.10; SET @@global.table_definition_cache = 21221204.10;
ERROR 42000: Incorrect argument type to variable 'table_definition_cache' ERROR 42000: Incorrect argument type to variable 'table_definition_cache'
SET @@global.table_definition_cache = ON; SET @@global.table_definition_cache = ON;
......
...@@ -64,9 +64,9 @@ SET @@global.table_definition_cache = 1; ...@@ -64,9 +64,9 @@ SET @@global.table_definition_cache = 1;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 2; SET @@global.table_definition_cache = 2;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 524287; SET @@global.table_definition_cache = 2097151;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 524288; SET @@global.table_definition_cache = 2097152;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
...@@ -79,7 +79,7 @@ SET @@global.table_definition_cache = 0; ...@@ -79,7 +79,7 @@ SET @@global.table_definition_cache = 0;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = -1024; SET @@global.table_definition_cache = -1024;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 524289; SET @@global.table_definition_cache = 2097153;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
SET @@global.table_definition_cache = 42949672950; SET @@global.table_definition_cache = 42949672950;
SELECT @@global.table_definition_cache; SELECT @@global.table_definition_cache;
......
...@@ -3039,11 +3039,15 @@ static Sys_var_charptr Sys_system_time_zone( ...@@ -3039,11 +3039,15 @@ static Sys_var_charptr Sys_system_time_zone(
NO_CMD_LINE, NO_CMD_LINE,
IN_SYSTEM_CHARSET, DEFAULT(system_time_zone)); IN_SYSTEM_CHARSET, DEFAULT(system_time_zone));
/*
If One use views with prepared statements this should be bigger than
table_open_cache (now we allow 2 times bigger value)
*/
static Sys_var_ulong Sys_table_def_size( static Sys_var_ulong Sys_table_def_size(
"table_definition_cache", "table_definition_cache",
"The number of cached table definitions", "The number of cached table definitions",
GLOBAL_VAR(tdc_size), CMD_LINE(REQUIRED_ARG), GLOBAL_VAR(tdc_size), CMD_LINE(REQUIRED_ARG),
VALID_RANGE(TABLE_DEF_CACHE_MIN, 512*1024), VALID_RANGE(TABLE_DEF_CACHE_MIN, 2*1024*1024),
DEFAULT(TABLE_DEF_CACHE_DEFAULT), BLOCK_SIZE(1)); DEFAULT(TABLE_DEF_CACHE_DEFAULT), BLOCK_SIZE(1));
...@@ -3055,7 +3059,7 @@ static bool fix_table_open_cache(sys_var *, THD *, enum_var_type) ...@@ -3055,7 +3059,7 @@ static bool fix_table_open_cache(sys_var *, THD *, enum_var_type)
return false; return false;
} }
/* Check the table_definition_cache comment if makes changes */
static Sys_var_ulong Sys_table_cache_size( static Sys_var_ulong Sys_table_cache_size(
"table_open_cache", "The number of cached open tables", "table_open_cache", "The number of cached open tables",
GLOBAL_VAR(tc_size), CMD_LINE(REQUIRED_ARG), GLOBAL_VAR(tc_size), CMD_LINE(REQUIRED_ARG),
......
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