diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-01-11 11:55:07 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-01-16 15:01:52 +0100 |
commit | db469b6907a02b1441b16eac1d464673f48f9ef4 (patch) | |
tree | 2f6a0c12f9940b8816ab0d10e9de3788bfbdc6d1 | |
parent | 12f362c3338d803b6659d9d446982b9bccbde640 (diff) | |
download | mariadb-git-db469b6907a02b1441b16eac1d464673f48f9ef4.tar.gz |
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).
-rw-r--r-- | mysql-test/suite/sys_vars/r/table_definition_cache_basic.result | 16 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/table_definition_cache_basic.test | 6 | ||||
-rw-r--r-- | sql/sys_vars.cc | 8 |
3 files changed, 17 insertions, 13 deletions
diff --git a/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result b/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result index f6befe51bc1..f7ce3f53bfc 100644 --- a/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result +++ b/mysql-test/suite/sys_vars/r/table_definition_cache_basic.result @@ -28,14 +28,14 @@ Warning 1292 Truncated incorrect table_definition_cache value: '2' SELECT @@global.table_definition_cache; @@global.table_definition_cache 400 -SET @@global.table_definition_cache = 524287; +SET @@global.table_definition_cache = 2097151; SELECT @@global.table_definition_cache; @@global.table_definition_cache -524287 -SET @@global.table_definition_cache = 524288; +2097151 +SET @@global.table_definition_cache = 2097152; SELECT @@global.table_definition_cache; @@global.table_definition_cache -524288 +2097152 '#--------------------FN_DYNVARS_019_04-------------------------#' SET @@global.table_definition_cache = 0; Warnings: @@ -49,18 +49,18 @@ Warning 1292 Truncated incorrect table_definition_cache value: '-1024' SELECT @@global.table_definition_cache; @@global.table_definition_cache 400 -SET @@global.table_definition_cache = 524289; +SET @@global.table_definition_cache = 2097153; Warnings: -Warning 1292 Truncated incorrect table_definition_cache value: '524289' +Warning 1292 Truncated incorrect table_definition_cache value: '2097153' SELECT @@global.table_definition_cache; @@global.table_definition_cache -524288 +2097152 SET @@global.table_definition_cache = 42949672950; Warnings: Warning 1292 Truncated incorrect table_definition_cache value: '42949672950' SELECT @@global.table_definition_cache; @@global.table_definition_cache -524288 +2097152 SET @@global.table_definition_cache = 21221204.10; ERROR 42000: Incorrect argument type to variable 'table_definition_cache' SET @@global.table_definition_cache = ON; diff --git a/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test index 69f29108645..183d1d0316e 100644 --- a/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test +++ b/mysql-test/suite/sys_vars/t/table_definition_cache_basic.test @@ -64,9 +64,9 @@ SET @@global.table_definition_cache = 1; SELECT @@global.table_definition_cache; SET @@global.table_definition_cache = 2; SELECT @@global.table_definition_cache; -SET @@global.table_definition_cache = 524287; +SET @@global.table_definition_cache = 2097151; SELECT @@global.table_definition_cache; -SET @@global.table_definition_cache = 524288; +SET @@global.table_definition_cache = 2097152; SELECT @@global.table_definition_cache; @@ -79,7 +79,7 @@ SET @@global.table_definition_cache = 0; SELECT @@global.table_definition_cache; SET @@global.table_definition_cache = -1024; SELECT @@global.table_definition_cache; -SET @@global.table_definition_cache = 524289; +SET @@global.table_definition_cache = 2097153; SELECT @@global.table_definition_cache; SET @@global.table_definition_cache = 42949672950; SELECT @@global.table_definition_cache; diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index a21fe5df247..71fdfa8f219 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -3039,11 +3039,15 @@ static Sys_var_charptr Sys_system_time_zone( NO_CMD_LINE, 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( "table_definition_cache", "The number of cached table definitions", 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)); @@ -3055,7 +3059,7 @@ static bool fix_table_open_cache(sys_var *, THD *, enum_var_type) return false; } - +/* Check the table_definition_cache comment if makes changes */ static Sys_var_ulong Sys_table_cache_size( "table_open_cache", "The number of cached open tables", GLOBAL_VAR(tc_size), CMD_LINE(REQUIRED_ARG), |