summaryrefslogtreecommitdiff
path: root/sql/set_var.cc
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-08-17 14:10:15 +0300
committerunknown <monty@narttu.mysql.fi>2003-08-17 14:10:15 +0300
commit0eaf4d8d7e879b32d5e1e0c7ecb409bc4d4cb060 (patch)
tree87feb8f1e2709918215eaa5b5031a4a243ba4531 /sql/set_var.cc
parent9ac61d15faf874589bd01ae9fa8d1854f6dc6621 (diff)
downloadmariadb-git-0eaf4d8d7e879b32d5e1e0c7ecb409bc4d4cb060.tar.gz
Fix mutex handling in SHOW_VARIABLES (key_buffer_size was not properly protected)
Changed some non fatal myisamchk error messages to warnings myisam/myisamchk.c: Change error -> warning sql/handler.cc: Add mutex around keybuff_size usage sql/mysql_priv.h: Indentation update sql/set_var.cc: Add mutex around longlong variable usage sql/sql_parse.cc: Fix mutex handling in SHOW_VARIABLES sql/sql_show.cc: Fix mutex handling in SHOW_VARIABLES
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r--sql/set_var.cc22
1 files changed, 20 insertions, 2 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc
index b3238d1c0ec..6dc36e312cb 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -729,10 +729,12 @@ void fix_max_relay_log_size(THD *thd, enum_var_type type)
bool sys_var_long_ptr::update(THD *thd, set_var *var)
{
ulonglong tmp= var->value->val_int();
+ pthread_mutex_lock(&LOCK_global_system_variables);
if (option_limits)
*value= (ulong) getopt_ull_limit_value(tmp, option_limits);
else
*value= (ulong) tmp;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
return 0;
}
@@ -746,17 +748,21 @@ void sys_var_long_ptr::set_default(THD *thd, enum_var_type type)
bool sys_var_ulonglong_ptr::update(THD *thd, set_var *var)
{
ulonglong tmp= var->value->val_int();
+ pthread_mutex_lock(&LOCK_global_system_variables);
if (option_limits)
*value= (ulonglong) getopt_ull_limit_value(tmp, option_limits);
else
*value= (ulonglong) tmp;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
return 0;
}
void sys_var_ulonglong_ptr::set_default(THD *thd, enum_var_type type)
{
+ pthread_mutex_lock(&LOCK_global_system_variables);
*value= (ulonglong) option_limits->def_value;
+ pthread_mutex_unlock(&LOCK_global_system_variables);
}
@@ -1000,9 +1006,21 @@ Item *sys_var::item(THD *thd, enum_var_type var_type)
case SHOW_LONG:
return new Item_uint((int32) *(ulong*) value_ptr(thd, var_type));
case SHOW_LONGLONG:
- return new Item_int(*(longlong*) value_ptr(thd, var_type));
+ {
+ longlong value;
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ value= *(longlong*) value_ptr(thd, var_type);
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ return new Item_int(value);
+ }
case SHOW_HA_ROWS:
- return new Item_int((longlong) *(ha_rows*) value_ptr(thd, var_type));
+ {
+ ha_rows value;
+ pthread_mutex_lock(&LOCK_global_system_variables);
+ value= *(ha_rows*) value_ptr(thd, var_type);
+ pthread_mutex_unlock(&LOCK_global_system_variables);
+ return new Item_int((longlong) value);
+ }
case SHOW_MY_BOOL:
return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type),1);
case SHOW_CHAR: