summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2003-11-20 22:06:25 +0200
committerunknown <monty@mysql.com>2003-11-20 22:06:25 +0200
commit35da5e43fbd3653c39358669365e2c329e1e555c (patch)
tree685b3a2a60fc00121d338cb0b5f84b4cd028bfe1 /sql/set_var.cc
parentf25cbdd9141004e6e9f0a7313d763c1cc1de36ec (diff)
downloadmariadb-git-35da5e43fbd3653c39358669365e2c329e1e555c.tar.gz
Merge key cache structures to one
Fixed compiler warnings (IRIX C compiler and VC++) VC++Files/client/mysqlclient.dsp: Add missing file to project VC++Files/libmysql/libmysql.dsp: Add missing file to project VC++Files/myisam/myisam.dsp: Add missing file to project VC++Files/mysys/mysys.dsp: Add missing file to project heap/hp_test1.c: Fixed wrong call to heap_rkey() heap/hp_test2.c: Fixed wrong call to heap_rkey() include/hash.h: Move not used (internal) struct to hash.c include/my_pthread.h: Made some structs 'const char*' to avoid warnings include/my_sys.h: Moved key cache structs and functions to keycache.h include/myisam.h: Merge key cache structures to one include/mysql.h: Remove STDCALL from internal functions include/sql_common.h: Remove STDCALL from internal functions include/violite.h: Fixed compiler warning isam/_locking.c: Merge key cache structures to one isam/_page.c: Merge key cache structures to one isam/close.c: Merge key cache structures to one isam/extra.c: Merge key cache structures to one isam/isamchk.c: Merge key cache structures to one isam/isamdef.h: Merge key cache structures to one isam/isamlog.c: Merge key cache structures to one isam/panic.c: Merge key cache structures to one isam/test2.c: Merge key cache structures to one isam/test3.c: Merge key cache structures to one libmysql/client_settings.h: Remove STDCALL from internal functions libmysql/libmysql.c: Remove STDCALL from internal functions myisam/ft_boolean_search.c: Fixed compiler warning myisam/ft_dump.c: Fixed compiler warnings (%qx is not portable) myisam/ft_update.c: Fixed compiler warnings myisam/mi_check.c: Merge key cache structures to one myisam/mi_close.c: Merge key cache structures to one myisam/mi_delete_all.c: Merge key cache structures to one myisam/mi_extra.c: Merge key cache structures to one myisam/mi_keycache.c: Merge key cache structures to one myisam/mi_locking.c: Merge key cache structures to one myisam/mi_page.c: Merge key cache structures to one myisam/mi_panic.c: Merge key cache structures to one myisam/mi_preload.c: Merge key cache structures to one myisam/mi_test1.c: Merge key cache structures to one myisam/mi_test2.c: Merge key cache structures to one myisam/mi_test3.c: Merge key cache structures to one myisam/myisamchk.c: Merge key cache structures to one myisam/myisamdef.h: Merge key cache structures to one myisam/myisamlog.c: Merge key cache structures to one Removed not used option myisam/sort.c: Fixed compiler warnings myisam/sp_test.c: Fixed compiler warnings mysql-test/r/case.result: Updated results after fix of correct NULL detection in WHEN mysql-test/r/date_formats.result: Updated results after fixing date handling mysql-test/r/symlink.result: Updated results after adding DEFAULT CHARSET mysql-test/t/case.test: New test mysql-test/t/symlink.test: Updated error numbers mysys/hash.c: Made HASH_LINK struct local mysys/mf_keycache.c: Merge key cache structures to one Fixed key_cache_read() and key_cache_write() to be resize-safe. mysys/mf_keycaches.c: Merge key cache structures to one mysys/thr_mutex.c: Added test if mutex is initalized sql-common/client.c: Remove STDCALL from internal functions sql/derror.cc: Added comment sql/field.cc: Removed not used variables sql/ha_innodb.cc: Fixed compiler warnings (removed not used variables) sql/ha_myisam.cc: Merge key cache structures to one sql/ha_myisammrg.cc: Removed not used variables sql/handler.cc: Merge key cache structures to one sql/handler.h: Merge key cache structures to one sql/item.cc: Fixed compiler warning sql/item_cmpfunc.cc: Remove not used variables sql/item_func.cc: Remove not used variables sql/item_strfunc.cc: Removed not used variables sql/item_sum.cc: Removed not used variables Moved setting of item_thd to fix_fields() sql/item_timefunc.cc: Removed not used variables sql/mysql_priv.h: Merge key cache structures to one sql/mysqld.cc: Merge key cache structures to one init_thread_environment() is not called before mysql_init_variables(). This fixes a case where a mutex was not initialized before it was used sql/opt_sum.cc: Remove not used variables sql/protocol.cc: Don't send errors after ok has been sent sql/protocol_cursor.cc: Remove not used variable Simple optimization sql/repl_failsafe.cc: Remove not used variables sql/set_var.cc: Merge key cache structures to one sql/set_var.h: Merge key cache structures to one sql/sql_acl.cc: Remove not used variables sql/sql_base.cc: Remove not used function sql/sql_db.cc: Remove not used variables sql/sql_handler.cc: Remove not used variables sql/sql_insert.cc: More DBUG statements Simple code cleanup sql/sql_lex.cc: Remove not used variables sql/sql_parse.cc: Remove not used variables sql/sql_prepare.cc: Remove not used variables sql/sql_repl.cc: Remove not used variables sql/sql_select.cc: Remove not used variables sql/sql_show.cc: Remove not used variables sql/sql_table.cc: Merge key cache structures to one Removed not used variables sql/sql_test.cc: Merge key cache structures to one sql/strfunc.cc: Fixed that find_type() returns correct value for partly matched words. (This fixed the error found by date_formats.test) sql/time.cc: Remove not used variables strings/my_strtoll10.c: Fixed compiler warnings
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc59
1 files changed, 29 insertions, 30 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index 9a4543ada00..a7d077d8fc2 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -92,7 +92,7 @@ static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type);
static void fix_max_binlog_size(THD *thd, enum_var_type type);
static void fix_max_relay_log_size(THD *thd, enum_var_type type);
static void fix_max_connections(THD *thd, enum_var_type type);
-static KEY_CACHE_VAR *create_key_cache(const char *name, uint length);
+static KEY_CACHE *create_key_cache(const char *name, uint length);
void fix_sql_mode_var(THD *thd, enum_var_type type);
static byte *get_error_count(THD *thd);
static byte *get_warning_count(THD *thd);
@@ -144,14 +144,14 @@ sys_var_thd_ulong sys_join_buffer_size("join_buffer_size",
&SV::join_buff_size);
sys_var_key_buffer_size sys_key_buffer_size("key_buffer_size");
sys_var_key_cache_long sys_key_cache_block_size("key_cache_block_size",
- offsetof(KEY_CACHE_VAR,
- block_size));
+ offsetof(KEY_CACHE,
+ param_block_size));
sys_var_key_cache_long sys_key_cache_division_limit("key_cache_division_limit",
- offsetof(KEY_CACHE_VAR,
- division_limit));
+ offsetof(KEY_CACHE,
+ param_division_limit));
sys_var_key_cache_long sys_key_cache_age_threshold("key_cache_age_threshold",
- offsetof(KEY_CACHE_VAR,
- age_threshold));
+ offsetof(KEY_CACHE,
+ param_age_threshold));
sys_var_bool_ptr sys_local_infile("local_infile",
&opt_local_infile);
sys_var_thd_bool sys_log_warnings("log_warnings", &SV::log_warnings);
@@ -1778,15 +1778,14 @@ void sys_var_collation_server::set_default(THD *thd, enum_var_type type)
LEX_STRING default_key_cache_base= {(char *) "default", 7 };
-static KEY_CACHE_VAR zero_key_cache=
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+static KEY_CACHE zero_key_cache;
-KEY_CACHE_VAR *get_key_cache(LEX_STRING *cache_name)
+KEY_CACHE *get_key_cache(LEX_STRING *cache_name)
{
safe_mutex_assert_owner(&LOCK_global_system_variables);
if (!cache_name || ! cache_name->length)
cache_name= &default_key_cache_base;
- return ((KEY_CACHE_VAR*) find_named(&key_caches,
+ return ((KEY_CACHE*) find_named(&key_caches,
cache_name->str, cache_name->length, 0));
}
@@ -1794,7 +1793,7 @@ KEY_CACHE_VAR *get_key_cache(LEX_STRING *cache_name)
byte *sys_var_key_cache_param::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
- KEY_CACHE_VAR *key_cache= get_key_cache(base);
+ KEY_CACHE *key_cache= get_key_cache(base);
if (!key_cache)
key_cache= &zero_key_cache;
return (byte*) key_cache + offset ;
@@ -1805,7 +1804,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
{
ulonglong tmp= var->save_result.ulonglong_value;
LEX_STRING *base_name= &var->base;
- KEY_CACHE_VAR *key_cache;
+ KEY_CACHE *key_cache;
bool error= 0;
/* If no basename, assume it's for the key cache named 'default' */
@@ -1840,14 +1839,14 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
if (key_cache == sql_key_cache)
goto end; // Ignore default key cache
- if (key_cache->cache) // If initied
+ if (key_cache->key_cache_inited) // If initied
{
/*
Move tables using this key cache to the default key cache
and clear the old key cache.
*/
NAMED_LIST *list;
- key_cache= (KEY_CACHE_VAR *) find_named(&key_caches, base_name->str,
+ key_cache= (KEY_CACHE *) find_named(&key_caches, base_name->str,
base_name->length, &list);
key_cache->in_init= 1;
pthread_mutex_unlock(&LOCK_global_system_variables);
@@ -1862,13 +1861,14 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
goto end;
}
- key_cache->buff_size= (ulonglong) getopt_ull_limit_value(tmp, option_limits);
+ key_cache->param_buff_size=
+ (ulonglong) getopt_ull_limit_value(tmp, option_limits);
/* If key cache didn't existed initialize it, else resize it */
key_cache->in_init= 1;
pthread_mutex_unlock(&LOCK_global_system_variables);
- if (!key_cache->cache)
+ if (!key_cache->key_cache_inited)
error= (bool) (ha_init_key_cache("", key_cache));
else
error= (bool)(ha_resize_key_cache(key_cache));
@@ -1892,7 +1892,7 @@ bool sys_var_key_cache_long::update(THD *thd, set_var *var)
base_name= &default_key_cache_base;
pthread_mutex_lock(&LOCK_global_system_variables);
- KEY_CACHE_VAR *key_cache= get_key_cache(base_name);
+ KEY_CACHE *key_cache= get_key_cache(base_name);
if (!key_cache && !(key_cache= create_key_cache(base_name->str,
base_name->length)))
@@ -2413,7 +2413,6 @@ byte *sys_var_thd_sql_mode::value_ptr(THD *thd, enum_var_type type,
ulong val;
char buff[256];
String tmp(buff, sizeof(buff), &my_charset_latin1);
- my_bool found= 0;
tmp.length(0);
val= ((type == OPT_GLOBAL) ? global_system_variables.*offset :
@@ -2543,13 +2542,13 @@ void delete_elements(I_List<NAMED_LIST> *list,
/* Key cache functions */
-static KEY_CACHE_VAR *create_key_cache(const char *name, uint length)
+static KEY_CACHE *create_key_cache(const char *name, uint length)
{
- KEY_CACHE_VAR *key_cache;
+ KEY_CACHE *key_cache;
DBUG_ENTER("create_key_cache");
DBUG_PRINT("enter",("name: %.*s", length, name));
- if ((key_cache= (KEY_CACHE_VAR*) my_malloc(sizeof(KEY_CACHE_VAR),
+ if ((key_cache= (KEY_CACHE*) my_malloc(sizeof(KEY_CACHE),
MYF(MY_ZEROFILL | MY_WME))))
{
if (!new NAMED_LIST(&key_caches, name, length, (gptr) key_cache))
@@ -2565,19 +2564,19 @@ static KEY_CACHE_VAR *create_key_cache(const char *name, uint length)
We don't set 'buff_size' as this is used to enable the key cache
*/
- key_cache->block_size= dflt_key_cache_var.block_size;
- key_cache->division_limit= dflt_key_cache_var.division_limit;
- key_cache->age_threshold= dflt_key_cache_var.age_threshold;
+ 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;
}
}
DBUG_RETURN(key_cache);
}
-KEY_CACHE_VAR *get_or_create_key_cache(const char *name, uint length)
+KEY_CACHE *get_or_create_key_cache(const char *name, uint length)
{
LEX_STRING key_cache_name;
- KEY_CACHE_VAR *key_cache;
+ KEY_CACHE *key_cache;
key_cache_name.str= (char *) name;
key_cache_name.length= length;
@@ -2589,21 +2588,21 @@ KEY_CACHE_VAR *get_or_create_key_cache(const char *name, uint length)
}
-void free_key_cache(const char *name, KEY_CACHE_VAR *key_cache)
+void free_key_cache(const char *name, KEY_CACHE *key_cache)
{
ha_end_key_cache(key_cache);
my_free((char*) key_cache, MYF(0));
}
-bool process_key_caches(int (* func) (const char *name, KEY_CACHE_VAR *))
+bool process_key_caches(int (* func) (const char *name, KEY_CACHE *))
{
I_List_iterator<NAMED_LIST> it(key_caches);
NAMED_LIST *element;
while ((element= it++))
{
- KEY_CACHE_VAR *key_cache= (KEY_CACHE_VAR *) element->data;
+ KEY_CACHE *key_cache= (KEY_CACHE *) element->data;
func(element->name, key_cache);
}
return 0;