diff options
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 86 |
1 files changed, 82 insertions, 4 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index 2af0a011b58..079a0eae3dc 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -59,6 +59,9 @@ #ifdef HAVE_INNOBASE_DB #include "ha_innodb.h" #endif +#ifdef HAVE_NDBCLUSTER_DB +#include "ha_ndbcluster.h" +#endif static HASH system_variable_hash; const char *bool_type_names[]= { "OFF", "ON", NullS }; @@ -102,6 +105,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 int check_max_delayed_threads(THD *thd, set_var *var); static void fix_thd_mem_root(THD *thd, enum_var_type type); static void fix_trans_mem_root(THD *thd, enum_var_type type); static KEY_CACHE *create_key_cache(const char *name, uint length); @@ -202,10 +206,13 @@ sys_var_long_ptr sys_max_connections("max_connections", sys_var_long_ptr sys_max_connect_errors("max_connect_errors", &max_connect_errors); sys_var_thd_ulong sys_max_insert_delayed_threads("max_insert_delayed_threads", - &SV::max_insert_delayed_threads); + &SV::max_insert_delayed_threads, + check_max_delayed_threads, + fix_max_connections); sys_var_thd_ulong sys_max_delayed_threads("max_delayed_threads", &SV::max_insert_delayed_threads, - 0, fix_max_connections); + check_max_delayed_threads, + fix_max_connections); sys_var_thd_ulong sys_max_error_count("max_error_count", &SV::max_error_count); sys_var_thd_ulong sys_max_heap_table_size("max_heap_table_size", @@ -236,6 +243,8 @@ sys_var_thd_ulong sys_max_tmp_tables("max_tmp_tables", &SV::max_tmp_tables); sys_var_long_ptr sys_max_write_lock_count("max_write_lock_count", &max_write_lock_count); +sys_var_long_ptr sys_myisam_data_pointer_size("myisam_data_pointer_size", + &myisam_data_pointer_size); sys_var_thd_ulonglong sys_myisam_max_extra_sort_file_size("myisam_max_extra_sort_file_size", &SV::myisam_max_extra_sort_file_size, fix_myisam_max_extra_sort_file_size, 1); sys_var_thd_ulonglong sys_myisam_max_sort_file_size("myisam_max_sort_file_size", &SV::myisam_max_sort_file_size, fix_myisam_max_sort_file_size, 1); sys_var_thd_ulong sys_myisam_repair_threads("myisam_repair_threads", &SV::myisam_repair_threads); @@ -515,6 +524,7 @@ sys_var *sys_variables[]= &sys_max_tmp_tables, &sys_max_user_connections, &sys_max_write_lock_count, + &sys_myisam_data_pointer_size, &sys_myisam_max_extra_sort_file_size, &sys_myisam_max_sort_file_size, &sys_myisam_repair_threads, @@ -635,6 +645,7 @@ struct show_var_st init_vars[]= { {"have_crypt", (char*) &have_crypt, SHOW_HAVE}, {"have_innodb", (char*) &have_innodb, SHOW_HAVE}, {"have_isam", (char*) &have_isam, SHOW_HAVE}, + {"have_ndbcluster", (char*) &have_ndbcluster, SHOW_HAVE}, {"have_openssl", (char*) &have_openssl, SHOW_HAVE}, {"have_query_cache", (char*) &have_query_cache, SHOW_HAVE}, {"have_raid", (char*) &have_raid, SHOW_HAVE}, @@ -714,6 +725,7 @@ struct show_var_st init_vars[]= { {sys_max_tmp_tables.name, (char*) &sys_max_tmp_tables, SHOW_SYS}, {sys_max_user_connections.name,(char*) &sys_max_user_connections, SHOW_SYS}, {sys_max_write_lock_count.name, (char*) &sys_max_write_lock_count,SHOW_SYS}, + {sys_myisam_data_pointer_size.name, (char*) &sys_myisam_data_pointer_size, SHOW_SYS}, {sys_myisam_max_extra_sort_file_size.name, (char*) &sys_myisam_max_extra_sort_file_size, SHOW_SYS}, @@ -842,7 +854,7 @@ bool update_sys_var_str(sys_var_str *var_str, rw_lock_t *var_mutex, uint new_length= (var ? var->value->str_value.length() : 0); if (!old_value) old_value= (char*) ""; - if (!(res= my_strdup_with_length(old_value, new_length, MYF(0)))) + if (!(res= my_strdup_with_length((byte*)old_value, new_length, MYF(0)))) return 1; /* Replace the old value in such a way that the any thread using @@ -902,7 +914,7 @@ static bool sys_update_ftb_syntax(THD *thd, set_var * var) static void sys_default_ftb_syntax(THD *thd, enum_var_type type) { - strmake(ft_boolean_syntax, opt_ft_boolean_syntax, + strmake(ft_boolean_syntax, def_ft_boolean_syntax, sizeof(ft_boolean_syntax)-1); } @@ -1085,6 +1097,20 @@ static void fix_max_relay_log_size(THD *thd, enum_var_type type) } +static int check_max_delayed_threads(THD *thd, set_var *var) +{ + longlong val= var->value->val_int(); + if (var->type != OPT_GLOBAL && val != 0 && + val != (longlong) global_system_variables.max_insert_delayed_threads) + { + char buf[64]; + my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), var->var->name, llstr(val, buf)); + return 1; + } + return 0; +} + + static void fix_max_connections(THD *thd, enum_var_type type) { resize_thr_alarm(max_connections + @@ -2554,6 +2580,36 @@ int set_var::check(THD *thd) } +/* + Check variable, but without assigning value (used by PS) + + SYNOPSIS + set_var::light_check() + thd thread handler + + RETURN VALUE + 0 ok + 1 ERROR, message sent (normally no variables was updated) + -1 ERROR, message not sent +*/ +int set_var::light_check(THD *thd) +{ + if (var->check_type(type)) + { + my_error(type == OPT_GLOBAL ? ER_LOCAL_VARIABLE : ER_GLOBAL_VARIABLE, + MYF(0), + var->name); + return -1; + } + if (type == OPT_GLOBAL && check_global_access(thd, SUPER_ACL)) + return 1; + + if (value && (value->fix_fields(thd, 0, &value) || value->check_cols(1))) + return -1; + return 0; +} + + int set_var::update(THD *thd) { if (!value) @@ -2581,6 +2637,28 @@ int set_var_user::check(THD *thd) } +/* + Check variable, but without assigning value (used by PS) + + SYNOPSIS + set_var_user::light_check() + thd thread handler + + RETURN VALUE + 0 ok + 1 ERROR, message sent (normally no variables was updated) + -1 ERROR, message not sent +*/ +int set_var_user::light_check(THD *thd) +{ + /* + Item_func_set_user_var can't substitute something else on its place => + 0 can be passed as last argument (reference on item) + */ + return (user_var_item->fix_fields(thd, 0, (Item**) 0)); +} + + int set_var_user::update(THD *thd) { if (user_var_item->update()) |