summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/keycaches.cc1
-rw-r--r--sql/log_slow.h67
-rw-r--r--sql/mysqld.cc2
-rw-r--r--sql/sys_vars.cc264
-rw-r--r--sql/sys_vars.h30
5 files changed, 160 insertions, 204 deletions
diff --git a/sql/keycaches.cc b/sql/keycaches.cc
index 14551803cfc..1da2f33fdad 100644
--- a/sql/keycaches.cc
+++ b/sql/keycaches.cc
@@ -118,6 +118,7 @@ KEY_CACHE *create_key_cache(const char *name, uint length)
key_cache->param_block_size= dflt_key_cache_var.param_block_size;
key_cache->param_division_limit= dflt_key_cache_var.param_division_limit;
key_cache->param_age_threshold= dflt_key_cache_var.param_age_threshold;
+ key_cache->param_partitions= dflt_key_cache_var.param_partitions;
}
}
DBUG_RETURN(key_cache);
diff --git a/sql/log_slow.h b/sql/log_slow.h
index 5559c002fde..91b74e690a0 100644
--- a/sql/log_slow.h
+++ b/sql/log_slow.h
@@ -19,31 +19,6 @@
#define LOG_SLOW_VERBOSITY_INNODB 1 << 0
#define LOG_SLOW_VERBOSITY_QUERY_PLAN 1 << 1
-#ifdef DEFINE_VARIABLES_LOG_SLOW
-
-/* Names here must be in same order as the bit's above */
-static const char *log_slow_verbosity_names[]=
-{
- "innodb","query_plan",
- NullS
-};
-
-static const unsigned int log_slow_verbosity_names_len[]=
-{
- sizeof("innodb") -1,
- sizeof("query_plan")-1
-};
-
-TYPELIB log_slow_verbosity_typelib=
-{ array_elements(log_slow_verbosity_names)-1,"", log_slow_verbosity_names,
- (unsigned int *) log_slow_verbosity_names_len };
-
-#else
-extern TYPELIB log_slow_verbosity_typelib;
-#endif /* DEFINE_VARIABLES_LOG_SLOW */
-
-/* Defines for what kind of query plan was used and what to log */
-
/*
We init the used query plan with a bit that is alwyas set and all 'no' bits
to enable easy testing of what to log in sql_log.cc
@@ -63,45 +38,5 @@ extern TYPELIB log_slow_verbosity_typelib;
#define QPLAN_MAX ((ulong) 1) << 31 /* reserved as placeholder */
#define QPLAN_ALWAYS_SET QPLAN_MAX
#define QPLAN_VISIBLE_MASK (~(QPLAN_ALWAYS_SET))
+#warning simplify
-#ifdef DEFINE_VARIABLES_LOG_SLOW
-/* Names here must be in same order as the bit's above */
-static const char *log_slow_filter_names[]=
-{
- "admin",
- "filesort",
- "filesort_on_disk",
- "full_join",
- "full_scan",
- "query_cache",
- "query_cache_miss",
- "tmp_table",
- "tmp_table_on_disk",
- NullS
-};
-
-static const unsigned int log_slow_filter_names_len[]=
-{
- sizeof("admin")-1,
- sizeof("filesort")-1,
- sizeof("filesort_on_disk")-1,
- sizeof("full_join")-1,
- sizeof("full_scan")-1,
- sizeof("query_cache")-1,
- sizeof("query_cache_miss")-1,
- sizeof("tmp_table")-1,
- sizeof("tmp_table_on_disk")-1
-};
-
-TYPELIB log_slow_filter_typelib=
-{ array_elements(log_slow_filter_names)-1,"", log_slow_filter_names,
- (unsigned int *) log_slow_filter_names_len };
-
-#else
-extern TYPELIB log_slow_filter_typelib;
-#endif /* DEFINE_VARIABLES_LOG_SLOW */
-
-static inline ulong fix_log_slow_filter(ulong org_filter)
-{
- return org_filter ? org_filter : QPLAN_ALWAYS_SET;
-}
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 658ec2b1bd9..106e2a4f0f5 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -52,8 +52,6 @@
#include "des_key_file.h" // load_des_key_file
#include "sql_manager.h" // stop_handle_manager, start_handle_manager
-#define DEFINE_VARIABLES_LOG_SLOW // Declare variables in log_slow.h
-
#include <m_ctype.h>
#include <my_dir.h>
#include <my_bit.h>
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 1f00818e274..c4f9e131e58 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -55,6 +55,7 @@
and include a file with the prototype instead.
*/
extern void close_thread_tables(THD *thd);
+#warning remove that
/*
The rule for this file: everything should be 'static'. When a sys_var
@@ -606,6 +607,9 @@ export bool fix_delay_key_write(sys_var *self, THD *thd, enum_var_type type)
ha_open_options|= HA_OPEN_DELAY_KEY_WRITE;
break;
}
+#ifdef WITH_ARIA_STORAGE_ENGINE
+ maria_delay_key_write= myisam_delay_key_write;
+#endif
return false;
}
static const char *delay_key_write_names[]= { "OFF", "ON", "ALL", NullS };
@@ -843,7 +847,7 @@ static Sys_var_keycache Sys_key_cache_block_size(
CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_BLOCK_SIZE),
VALID_RANGE(512, 1024*16), DEFAULT(KEY_CACHE_BLOCK_SIZE),
BLOCK_SIZE(512), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
- ON_UPDATE(update_keycache_param));
+ ON_UPDATE(resize_keycache));
static Sys_var_keycache Sys_key_cache_division_limit(
"key_cache_division_limit",
@@ -852,7 +856,7 @@ static Sys_var_keycache Sys_key_cache_division_limit(
CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_DIVISION_LIMIT),
VALID_RANGE(1, 100), DEFAULT(100),
BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
- ON_UPDATE(update_keycache_param));
+ ON_UPDATE(change_keycache_param));
static Sys_var_keycache Sys_key_cache_age_threshold(
"key_cache_age_threshold", "This characterizes the number of "
@@ -864,7 +868,7 @@ static Sys_var_keycache Sys_key_cache_age_threshold(
CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_AGE_THRESHOLD),
VALID_RANGE(100, ULONG_MAX), DEFAULT(300),
BLOCK_SIZE(100), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
- ON_UPDATE(update_keycache_param));
+ ON_UPDATE(change_keycache_param));
static Sys_var_mybool Sys_large_files_support(
"large_files_support",
@@ -1060,7 +1064,7 @@ static Sys_var_ulong Sys_max_binlog_size(
static bool fix_max_connections(sys_var *self, THD *thd, enum_var_type type)
{
#ifndef EMBEDDED_LIBRARY
- resize_thr_alarm(max_connections +
+ resize_thr_alarm(max_connections + extra_max_connections +
global_system_variables.max_insert_delayed_threads + 10);
#endif
return false;
@@ -1680,13 +1684,19 @@ static Sys_var_ulong Sys_trans_prealloc_size(
static const char *thread_handling_names[]=
{
- "one-thread-per-connection", "no-threads", "loaded-dynamically",
+ "one-thread-per-connection", "no-threads",
+#if HAVE_POOL_OF_THREADS == 1
+ "pool-of-threads",
+#endif
0
};
static Sys_var_enum Sys_thread_handling(
"thread_handling",
"Define threads usage for handling queries, one of "
- "one-thread-per-connection, no-threads, loaded-dynamically"
+ "one-thread-per-connection, no-threads, "
+#if HAVE_POOL_OF_THREADS == 1
+ "pool-of-threads"
+#endif
, READ_ONLY GLOBAL_VAR(thread_handling), CMD_LINE(REQUIRED_ARG),
thread_handling_names, DEFAULT(0));
@@ -3124,137 +3134,127 @@ static Sys_var_enum Sys_plugin_maturity(
READ_ONLY GLOBAL_VAR(server_maturity), CMD_LINE(REQUIRED_ARG),
plugin_maturity_names, DEFAULT(MariaDB_PLUGIN_MATURITY_UNKNOWN));
-#error *may be* turn the below into sysvars
-
- {"deadlock-search-depth-short", OPT_DEADLOCK_SEARCH_DEPTH_SHORT,
- "Short search depth for the two-step deadlock detection",
- &global_system_variables.wt_deadlock_search_depth_short,
- &max_system_variables.wt_deadlock_search_depth_short,
- 0, GET_ULONG, REQUIRED_ARG, 4, 0, 32, 0, 0, 0},
- {"deadlock-search-depth-long", OPT_DEADLOCK_SEARCH_DEPTH_LONG,
- "Long search depth for the two-step deadlock detection",
- &global_system_variables.wt_deadlock_search_depth_long,
- &max_system_variables.wt_deadlock_search_depth_long,
- 0, GET_ULONG, REQUIRED_ARG, 15, 0, 33, 0, 0, 0},
- {"deadlock-timeout-short", OPT_DEADLOCK_TIMEOUT_SHORT,
- "Short timeout for the two-step deadlock detection (in microseconds)",
- &global_system_variables.wt_timeout_short,
- &max_system_variables.wt_timeout_short,
- 0, GET_ULONG, REQUIRED_ARG, 10000, 0, ULONG_MAX, 0, 0, 0},
- {"deadlock-timeout-long", OPT_DEADLOCK_TIMEOUT_LONG,
- "Long timeout for the two-step deadlock detection (in microseconds)",
- &global_system_variables.wt_timeout_long,
- &max_system_variables.wt_timeout_long,
- 0, GET_ULONG, REQUIRED_ARG, 50000000, 0, ULONG_MAX, 0, 0, 0},
-
- {"debug-crc-break", OPT_DEBUG_CRC,
- "Call my_debug_put_break_here() if crc matches this number (for debug).",
- &my_crc_dbug_check, &my_crc_dbug_check,
- 0, GET_ULONG, REQUIRED_ARG, 0, 0, ~(ulong) 0L, 0, 0, 0},
-
- {"extra-port", OPT_EXTRA_PORT,
- "Extra port number to use for tcp-connections in a one-thread-per-connection manner. 0 means don't use another port",
- &mysqld_extra_port,
- &mysqld_extra_port, 0, GET_UINT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"extra-max-connections", OPT_MAX_CONNECTIONS,
- "The number of connections on 'extra-port.",
- &extra_max_connections,
- &extra_max_connections, 0, GET_ULONG, REQUIRED_ARG, 1, 1, 100000,
- 0, 1, 0},
+static Sys_var_ulong Sys_deadlock_search_depth_short(
+ "deadlock_search_depth_short",
+ "Short search depth for the two-step deadlock detection",
+ SESSION_VAR(wt_deadlock_search_depth_short), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, 32), DEFAULT(4), BLOCK_SIZE(1));
+
+static Sys_var_ulong Sys_deadlock_search_depth_long(
+ "deadlock_search_depth_long",
+ "Long search depth for the two-step deadlock detection",
+ SESSION_VAR(wt_deadlock_search_depth_long), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, 33), DEFAULT(15), BLOCK_SIZE(1));
+
+static Sys_var_ulong Sys_deadlock_timeout_depth_short(
+ "deadlock_timeout_short",
+ "Short timeout for the two-step deadlock detection (in microseconds)",
+ SESSION_VAR(wt_timeout_short), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, ULONG_MAX), DEFAULT(10000), BLOCK_SIZE(1));
+
+static Sys_var_ulong Sys_deadlock_timeout_depth_long(
+ "deadlock_timeout_long",
+ "Long timeout for the two-step deadlock detection (in microseconds)",
+ SESSION_VAR(wt_timeout_long), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, ULONG_MAX), DEFAULT(50000000), BLOCK_SIZE(1));
-#ifdef SAFE_MUTEX
- {"mutex-deadlock-detector", OPT_MUTEX_DEADLOCK_DETECTOR,
- "Enable checking of wrong mutex usage.",
- &safe_mutex_deadlock_detector,
- &safe_mutex_deadlock_detector,
- 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
+#ifndef DBUG_OFF
+static Sys_var_ulong Sys_debug_crc_break(
+ "debug_crc_break",
+ "Call my_debug_put_break_here() if crc matches this number (for debug)",
+ GLOBAL_VAR(my_crc_dbug_check), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, ULONG_MAX), DEFAULT(0), BLOCK_SIZE(1));
#endif
- {"safemalloc-mem-limit", OPT_SAFEMALLOC_MEM_LIMIT,
- "Simulate memory shortage when compiled with the --with-debug=full option.",
- 0, 0, 0, GET_ULL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
+static Sys_var_uint Sys_extra_port(
+ "extra_port",
+ "Extra port number to use for tcp connections in a "
+ "one-thread-per-connection manner. 0 means don't use another port",
+ READ_ONLY GLOBAL_VAR(mysqld_extra_port), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, UINT_MAX32), DEFAULT(0), BLOCK_SIZE(1));
+#warning generalize that
-#ifndef DBUG_OFF
-#ifdef SAFEMALLOC
- {"skip-safemalloc", OPT_SKIP_SAFEMALLOC,
- "Don't use the memory allocation checking.", 0, 0, 0, GET_NO_ARG, NO_ARG,
- 0, 0, 0, 0, 0, 0}, sf_malloc_quick=1;
-#endif
+static Sys_var_ulong Sys_extra_max_connections(
+ "extra_max_connections", "The number of connections on extra-port",
+ GLOBAL_VAR(extra_max_connections), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(1, 100000), DEFAULT(1), BLOCK_SIZE(1), NO_MUTEX_GUARD,
+ NOT_IN_BINLOG, ON_CHECK(0), ON_UPDATE(fix_max_connections));
+
+#ifdef SAFE_MUTEX
+static Sys_var_mybool Sys_mutex_deadlock_detector(
+ "mutex_deadlock_detector", "Enable checking of wrong mutex usage",
+ READ_ONLY GLOBAL_VAR(safe_mutex_deadlock_detector),
+ CMD_LINE(OPT_ARG), DEFAULT(TRUE));
#endif
- {"log-slow-time", OPT_LONG_QUERY_TIME,
- "Log all queries that have taken more than long_query_time seconds to execute to file. "
- "The argument will be treated as a decimal value with microsecond precission.",
- &long_query_time, &long_query_time, 0, GET_DOUBLE,
- REQUIRED_ARG, 10, 0, LONG_TIMEOUT, 0, 0, 0},
- {"key_cache_segments", OPT_KEY_CACHE_PARTITIONS,
- "The number of segments in a key cache",
- &dflt_key_cache_var.param_partitions, 0,
- 0, (GET_ULONG | GET_ASK_ADDR), REQUIRED_ARG, DEFAULT_KEY_CACHE_PARTITIONS,
- 0, MAX_KEY_CACHE_PARTITIONS, 0, 1, 0},
- {"log-slow-filter", OPT_LOG_SLOW_FILTER,
- "Log only the queries that followed certain execution plan. Multiple flags "
- "allowed in a comma-separated string. [admin, filesort, filesort_on_disk, "
- "full_join, full_scan, query_cache, query_cache_miss, tmp_table, "
- "tmp_table_on_disk]. Sets log-slow-admin-command to ON",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, QPLAN_ALWAYS_SET, 0, 0},
- {"log-slow-rate_limit", OPT_LOG_SLOW_RATE_LIMIT,
- "If set, only write to slow log every 'log_slow_rate_limit' query (use "
- "this to reduce output on slow query log)",
- &global_system_variables.log_slow_rate_limit,
- &max_system_variables.log_slow_rate_limit, 0, GET_ULONG,
- REQUIRED_ARG, 1, 1, ~0L, 0, 1L, 0},
- {"log-slow-verbosity", OPT_LOG_SLOW_VERBOSITY,
- "Choose how verbose the messages to your slow log will be. Multiple flags "
- "allowed in a comma-separated string. [query_plan, innodb]",
- 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- global_system_variables.log_slow_verbosity= LOG_SLOW_VERBOSITY_INIT;
- global_system_variables.log_slow_filter= QPLAN_ALWAYS_SET;
- {"log-slow-file", OPT_SLOW_QUERY_LOG_FILE,
- "Log slow queries to given log file. Defaults logging to hostname-slow.log",
- &opt_slow_logname, &opt_slow_logname, 0, GET_STR,
- REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
- {"join_cache_level", OPT_JOIN_CACHE_LEVEL,
- "Controls what join operations can be executed with join buffers. Odd numbers are used for plain join buffers while even numbers are used for linked buffers",
- &global_system_variables.join_cache_level,
- &max_system_variables.join_cache_level,
- 0, GET_ULONG, REQUIRED_ARG, 1, 0, 8, 0, 1, 0},
- {"mrr_buffer_size", OPT_MRR_BUFFER_SIZE,
- "Size of buffer to use when using MRR with range access",
- (uchar**) &global_system_variables.mrr_buff_size,
- (uchar**) &max_system_variables.mrr_buff_size, 0,
- GET_ULONG, REQUIRED_ARG, 256*1024L, IO_SIZE*2+MALLOC_OVERHEAD,
- INT_MAX32, MALLOC_OVERHEAD, 1 /* Small to be able to do tests */ , 0},
-
- {"sync-sys", OPT_SYNC,
+static Sys_var_keycache Sys_key_cache_segments(
+ "key_cache_segments", "The number of segments in a key cache",
+ KEYCACHE_VAR(param_partitions),
+ CMD_LINE(REQUIRED_ARG, OPT_KEY_CACHE_PARTITIONS),
+ VALID_RANGE(0, MAX_KEY_CACHE_PARTITIONS),
+ DEFAULT(DEFAULT_KEY_CACHE_PARTITIONS),
+ BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
+ ON_UPDATE(repartition_keycache));
+
+static const char *log_slow_filter_names[]=
+{ "admin", "filesort", "filesort_on_disk", "full_join", "full_scan",
+ "query_cache", "query_cache_miss", "tmp_table", "tmp_table_on_disk", 0
+};
+static Sys_var_set Sys_log_slow_filter(
+ "log_slow_filter",
+ "Log only certain types of queries. Multiple "
+ "flags can be specified, separated by commas. Valid values are admin, "
+ "slave, filesort, filesort_on_disk, full_join, full_scan, query_cache, "
+ "query_cache_miss, tmp_table, tmp_table_on_disk",
+ SESSION_VAR(log_slow_filter), CMD_LINE(REQUIRED_ARG),
+ log_slow_filter_names, DEFAULT(QPLAN_ALWAYS_SET));
+#warning fix log-slow-slave-statements and log-slow-admin-statements
+
+static Sys_var_ulong Sys_log_slow_rate_limit(
+ "log_slow_rate_limit",
+ "Write to slow log every #th slow query. Set to 1 to log everything. "
+ "Increase it to reduce the size of the slow or the performance impact "
+ "of slow logging",
+ SESSION_VAR(log_slow_rate_limit), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(1, ULONG_MAX), DEFAULT(1), BLOCK_SIZE(1));
+
+static const char *log_slow_verbosity_names[]= { "innodb", "query_plan", 0 };
+static Sys_var_set Sys_log_slow_verbosity(
+ "log_slow_verbosity",
+ "log-slow-verbosity=[value[,value ...]] where value is one of "
+ "'innodb', 'query_plan'"
+ SESSION_VAR(log_slow_verbosity), CMD_LINE(REQUIRED_ARG),
+ log_slow_verbosity_names, DEFAULT(LOG_SLOW_VERBOSITY_INIT));
+
+static Sys_var_ulong Sys_join_cache_level(
+ "join_cache_level",
+ "Controls what join operations can be executed with join buffers. Odd "
+ "numbers are used for plain join buffers while even numbers are used "
+ "for linked buffers",
+ SESSION_VAR(join_cache_level), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, 8), DEFAULT(1), BLOCK_SIZE(1));
+
+static Sys_var_ulong Sys_mrr_buffer_size(
+ "mrr_buffer_size",
+ "Size of buffer to use when using MRR with range access",
+ SESSION_VAR(mrr_buff_size), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(IO_SIZE*2, INT_MAX32), DEFAULT(256*1024), BLOCK_SIZE(1));
+
+/* {"sync_sys", OPT_SYNC,
"Enable/disable system sync calls. Should only be turned off when running "
"tests or debugging!!",
- &opt_sync, &opt_sync, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},
- {"rowid_merge_buff_size", OPT_ROWID_MERGE_BUFF_SIZE,
- "The size of the buffers used [NOT] IN evaluation via partial matching.",
- (uchar**) &global_system_variables.rowid_merge_buff_size,
- (uchar**) &max_system_variables.rowid_merge_buff_size, 0, GET_ULONG,
- REQUIRED_ARG, 8*1024*1024L, 0, MAX_MEM_TABLE_SIZE/2, 0, 1, 0},
- {"userstat", OPT_USERSTAT,
- "Control USER_STATISTICS, CLIENT_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS running",
- (uchar**) &opt_userstat_running, (uchar**) &opt_userstat_running,
- 0, GET_BOOL, NO_ARG, 0, 0, 1, 0, 1, 0},
- case OPT_LOG_SLOW_FILTER:
- global_system_variables.log_slow_filter=
- find_bit_type_or_exit(argument, &log_slow_filter_typelib,
- opt->name, &error);
- /*
- If we are using filters, we set opt_slow_admin_statements to be always
- true so we can maintain everything with filters
- */
- opt_log_slow_admin_statements= 1;
- if (error)
- return 1;
- break;
- case OPT_LOG_SLOW_VERBOSITY:
- global_system_variables.log_slow_verbosity=
- find_bit_type_or_exit(argument, &log_slow_verbosity_typelib,
- opt->name, &error);
- if (error)
- return 1;
- break;
+ &opt_sync, &opt_sync, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0},*/
+
+static Sys_var_ulong Sys_rowid_merge_buff_size(
+ "rowid_merge_buff_size",
+ "The size of the buffers used [NOT] IN evaluation via partial matching",
+ SESSION_VAR(rowid_merge_buff_size), CMD_LINE(REQUIRED_ARG),
+ VALID_RANGE(0, MAX_MEM_TABLE_SIZE/2), DEFAULT(8*1024*1024),
+ BLOCK_SIZE(1));
+
+static Sys_var_mybool Sys_userstat(
+ "userstat",
+ "Enables statistics gathering for USER_STATISTICS, CLIENT_STATISTICS, "
+ "INDEX_STATISTICS and TABLE_STATISTICS tables in the INFORMATION_SCHEMA",
+ GLOBAL_VAR(opt_userstat_running),
+ CMD_LINE(OPT_ARG), DEFAULT(TRUE));
diff --git a/sql/sys_vars.h b/sql/sys_vars.h
index 740c4f03e3e..e0769836e61 100644
--- a/sql/sys_vars.h
+++ b/sql/sys_vars.h
@@ -703,8 +703,9 @@ static bool update_buffer_size(THD *thd, KEY_CACHE *key_cache,
return error;
}
-static bool update_keycache_param(THD *thd, KEY_CACHE *key_cache,
- ptrdiff_t offset, ulonglong new_value)
+static bool update_keycache(THD *thd, KEY_CACHE *key_cache,
+ ptrdiff_t offset, ulonglong new_value,
+ (int)(*)(KEY_CACHE *) func)
{
bool error= false;
DBUG_ASSERT(offset != offsetof(KEY_CACHE, param_buff_size));
@@ -713,14 +714,35 @@ static bool update_keycache_param(THD *thd, KEY_CACHE *key_cache,
key_cache->in_init= 1;
mysql_mutex_unlock(&LOCK_global_system_variables);
- error= ha_resize_key_cache(key_cache);
-
+ error= func(key_cache);
mysql_mutex_lock(&LOCK_global_system_variables);
key_cache->in_init= 0;
return error;
}
+static bool resize_keycache(THD *thd, KEY_CACHE *key_cache,
+ ptrdiff_t offset, ulonglong new_value)
+{
+ return update_keycache(thd, key_cache, offset, new_value,
+ ha_resize_key_cache);
+}
+
+static bool change_keycache_param(THD *thd, KEY_CACHE *key_cache,
+ ptrdiff_t offset, ulonglong new_value)
+{
+ return update_keycache(thd, key_cache, offset, new_value,
+ ha_change_key_cache_param);
+}
+
+static bool repartition_keycache(THD *thd, KEY_CACHE *key_cache,
+ ptrdiff_t offset, ulonglong new_value)
+{
+ return update_keycache(thd, key_cache, offset, new_value,
+ ha_repartition_key_cache);
+}
+
+
/**
The class for floating point variables