[Commits] 1481d7a58b5: MDEV-17475: Increase maximum possible value for table_definition_cache to match table_open_cache

Oleksandr Byelkin sanja at mariadb.com
Fri Jan 11 12:55:07 EET 2019


revision-id: 1481d7a58b537d75f0a110e8a0514706adec669e (mariadb-10.0.37-41-g1481d7a58b5)
parent(s): d0d0f88f2cd4da23c2c2da702da51fb533e7fb8a
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2019-01-11 11:55:07 +0100
message:

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).

---
 .../suite/sys_vars/r/table_definition_cache_basic.result | 16 ++++++++--------
 .../suite/sys_vars/t/table_definition_cache_basic.test   |  6 +++---
 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),


More information about the commits mailing list