Commit 37f87d73 authored by Sergei Golubchik's avatar Sergei Golubchik

updated sys_vars.cc (converting 5.3 mysqld.cc and set_var.cc

changes appropriately)
parent 65ca700d
...@@ -118,6 +118,7 @@ KEY_CACHE *create_key_cache(const char *name, uint length) ...@@ -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_block_size= dflt_key_cache_var.param_block_size;
key_cache->param_division_limit= dflt_key_cache_var.param_division_limit; 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_age_threshold= dflt_key_cache_var.param_age_threshold;
key_cache->param_partitions= dflt_key_cache_var.param_partitions;
} }
} }
DBUG_RETURN(key_cache); DBUG_RETURN(key_cache);
......
...@@ -19,31 +19,6 @@ ...@@ -19,31 +19,6 @@
#define LOG_SLOW_VERBOSITY_INNODB 1 << 0 #define LOG_SLOW_VERBOSITY_INNODB 1 << 0
#define LOG_SLOW_VERBOSITY_QUERY_PLAN 1 << 1 #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 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 to enable easy testing of what to log in sql_log.cc
...@@ -63,45 +38,5 @@ extern TYPELIB log_slow_verbosity_typelib; ...@@ -63,45 +38,5 @@ extern TYPELIB log_slow_verbosity_typelib;
#define QPLAN_MAX ((ulong) 1) << 31 /* reserved as placeholder */ #define QPLAN_MAX ((ulong) 1) << 31 /* reserved as placeholder */
#define QPLAN_ALWAYS_SET QPLAN_MAX #define QPLAN_ALWAYS_SET QPLAN_MAX
#define QPLAN_VISIBLE_MASK (~(QPLAN_ALWAYS_SET)) #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;
}
...@@ -52,8 +52,6 @@ ...@@ -52,8 +52,6 @@
#include "des_key_file.h" // load_des_key_file #include "des_key_file.h" // load_des_key_file
#include "sql_manager.h" // stop_handle_manager, start_handle_manager #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 <m_ctype.h>
#include <my_dir.h> #include <my_dir.h>
#include <my_bit.h> #include <my_bit.h>
......
This diff is collapsed.
...@@ -703,8 +703,9 @@ static bool update_buffer_size(THD *thd, KEY_CACHE *key_cache, ...@@ -703,8 +703,9 @@ static bool update_buffer_size(THD *thd, KEY_CACHE *key_cache,
return error; return error;
} }
static bool update_keycache_param(THD *thd, KEY_CACHE *key_cache, static bool update_keycache(THD *thd, KEY_CACHE *key_cache,
ptrdiff_t offset, ulonglong new_value) ptrdiff_t offset, ulonglong new_value,
(int)(*)(KEY_CACHE *) func)
{ {
bool error= false; bool error= false;
DBUG_ASSERT(offset != offsetof(KEY_CACHE, param_buff_size)); DBUG_ASSERT(offset != offsetof(KEY_CACHE, param_buff_size));
...@@ -713,14 +714,35 @@ static bool update_keycache_param(THD *thd, KEY_CACHE *key_cache, ...@@ -713,14 +714,35 @@ static bool update_keycache_param(THD *thd, KEY_CACHE *key_cache,
key_cache->in_init= 1; key_cache->in_init= 1;
mysql_mutex_unlock(&LOCK_global_system_variables); 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); mysql_mutex_lock(&LOCK_global_system_variables);
key_cache->in_init= 0; key_cache->in_init= 0;
return error; 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 The class for floating point variables
......
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