mirror of
https://github.com/MariaDB/server.git
synced 2026-05-15 19:37:16 +02:00
Merge mysql.com:/home/gluh/MySQL/Merge/5.1
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt BitKeeper/etc/ignore: auto-union client/mysql.cc: Auto merged client/mysqltest.c: Auto merged include/mysql_com.h: Auto merged libmysql/CMakeLists.txt: Auto merged libmysqld/lib_sql.cc: Auto merged mysql-test/r/archive.result: Auto merged mysql-test/r/create.result: Auto merged mysql-test/r/delayed.result: Auto merged mysql-test/r/func_misc.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/r/innodb_mysql.result: Auto merged mysql-test/r/merge.result: Auto merged mysql-test/r/ps.result: Auto merged mysql-test/r/type_date.result: Auto merged mysql-test/suite/rpl/r/rpl_innodb_bug28430.result: Auto merged mysql-test/t/create.test: Auto merged mysql-test/t/func_misc.test: Auto merged mysql-test/t/information_schema.test: Auto merged mysql-test/t/merge.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/type_date.test: Auto merged mysql-test/t/type_datetime.test: Auto merged mysql-test/t/variables.test: Auto merged mysys/queues.c: Auto merged sql/events.cc: Auto merged sql/field.cc: Auto merged sql/field.h: Auto merged sql/ha_partition.cc: Auto merged sql/handler.cc: Auto merged sql/item.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.h: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/opt_range.cc: Auto merged sql/protocol.cc: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_partition.cc: Auto merged sql/sql_plugin.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_string.cc: Auto merged sql/sql_table.cc: Auto merged sql/sql_yacc.yy: Auto merged sql/table.cc: Auto merged sql/table.h: Auto merged storage/myisam/ha_myisam.cc: Auto merged storage/myisam/mi_check.c: Auto merged storage/myisam/mi_open.c: Auto merged tests/mysql_client_test.c: Auto merged mysql-test/lib/mtr_report.pl: manual merge mysql-test/r/myisam.result: manual merge mysql-test/r/partition.result: manual merge mysql-test/r/user_var.result: manual merge mysql-test/t/myisam.test: manual merge mysql-test/t/partition.test: manual merge mysql-test/t/user_var.test: manual merge sql/item.h: manual merge sql/item_func.cc: manual merge storage/myisammrg/ha_myisammrg.cc: manual merge
This commit is contained in:
commit
9a10c20ba9
133 changed files with 2674 additions and 678 deletions
|
|
@ -120,6 +120,10 @@ 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 void fix_server_id(THD *thd, enum_var_type type);
|
||||
static ulonglong fix_unsigned(THD *thd, ulonglong num,
|
||||
const struct my_option *option_limits);
|
||||
static bool get_unsigned(THD *thd, set_var *var);
|
||||
static void throw_bounds_warning(THD *thd, const char *name, ulonglong num);
|
||||
static KEY_CACHE *create_key_cache(const char *name, uint length);
|
||||
void fix_sql_mode_var(THD *thd, enum_var_type type);
|
||||
static uchar *get_error_count(THD *thd);
|
||||
|
|
@ -1102,6 +1106,39 @@ static void fix_server_id(THD *thd, enum_var_type type)
|
|||
}
|
||||
|
||||
|
||||
static void throw_bounds_warning(THD *thd, const char *name, ulonglong num)
|
||||
{
|
||||
char buf[22];
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_TRUNCATED_WRONG_VALUE,
|
||||
ER(ER_TRUNCATED_WRONG_VALUE), name,
|
||||
ullstr(num, buf));
|
||||
}
|
||||
|
||||
static ulonglong fix_unsigned(THD *thd, ulonglong num,
|
||||
const struct my_option *option_limits)
|
||||
{
|
||||
bool fixed= FALSE;
|
||||
ulonglong out= getopt_ull_limit_value(num, option_limits, &fixed);
|
||||
|
||||
if (fixed)
|
||||
throw_bounds_warning(thd, option_limits->name, num);
|
||||
return out;
|
||||
}
|
||||
|
||||
static bool get_unsigned(THD *thd, set_var *var)
|
||||
{
|
||||
if (var->value->unsigned_flag)
|
||||
var->save_result.ulonglong_value= (ulonglong) var->value->val_int();
|
||||
else
|
||||
{
|
||||
longlong v= var->value->val_int();
|
||||
var->save_result.ulonglong_value= (ulonglong) ((v < 0) ? 0 : v);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
sys_var_long_ptr::
|
||||
sys_var_long_ptr(sys_var_chain *chain, const char *name_arg, ulong *value_ptr_arg,
|
||||
sys_after_update_func after_update_arg)
|
||||
|
|
@ -1112,9 +1149,7 @@ sys_var_long_ptr(sys_var_chain *chain, const char *name_arg, ulong *value_ptr_ar
|
|||
|
||||
bool sys_var_long_ptr_global::check(THD *thd, set_var *var)
|
||||
{
|
||||
longlong v= var->value->val_int();
|
||||
var->save_result.ulonglong_value= v < 0 ? 0 : v;
|
||||
return 0;
|
||||
return get_unsigned(thd, var);
|
||||
}
|
||||
|
||||
bool sys_var_long_ptr_global::update(THD *thd, set_var *var)
|
||||
|
|
@ -1122,9 +1157,20 @@ bool sys_var_long_ptr_global::update(THD *thd, set_var *var)
|
|||
ulonglong tmp= var->save_result.ulonglong_value;
|
||||
pthread_mutex_lock(guard);
|
||||
if (option_limits)
|
||||
*value= (ulong) getopt_ull_limit_value(tmp, option_limits);
|
||||
*value= (ulong) fix_unsigned(thd, tmp, option_limits);
|
||||
else
|
||||
{
|
||||
#if SIZEOF_LONG < SIZEOF_LONG_LONG
|
||||
/* Avoid overflows on 32 bit systems */
|
||||
if (tmp > ULONG_MAX)
|
||||
{
|
||||
tmp= ULONG_MAX;
|
||||
throw_bounds_warning(thd, name, var->save_result.ulonglong_value);
|
||||
}
|
||||
#endif
|
||||
*value= (ulong) tmp;
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(guard);
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1143,7 +1189,7 @@ bool sys_var_ulonglong_ptr::update(THD *thd, set_var *var)
|
|||
ulonglong tmp= var->save_result.ulonglong_value;
|
||||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
if (option_limits)
|
||||
*value= (ulonglong) getopt_ull_limit_value(tmp, option_limits);
|
||||
*value= (ulonglong) fix_unsigned(thd, tmp, option_limits);
|
||||
else
|
||||
*value= (ulonglong) tmp;
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
|
|
@ -1186,45 +1232,36 @@ uchar *sys_var_enum::value_ptr(THD *thd, enum_var_type type, LEX_STRING *base)
|
|||
|
||||
bool sys_var_thd_ulong::check(THD *thd, set_var *var)
|
||||
{
|
||||
return (sys_var_thd::check(thd, var) ||
|
||||
return (get_unsigned(thd, var) ||
|
||||
(check_func && (*check_func)(thd, var)));
|
||||
}
|
||||
|
||||
bool sys_var_thd_ulong::update(THD *thd, set_var *var)
|
||||
{
|
||||
ulonglong tmp= var->save_result.ulonglong_value;
|
||||
char buf[22];
|
||||
bool truncated= false;
|
||||
|
||||
/* Don't use bigger value than given with --maximum-variable-name=.. */
|
||||
if ((ulong) tmp > max_system_variables.*offset)
|
||||
{
|
||||
truncated= true;
|
||||
llstr(tmp, buf);
|
||||
throw_bounds_warning(thd, name, tmp);
|
||||
tmp= max_system_variables.*offset;
|
||||
}
|
||||
|
||||
#if SIZEOF_LONG == 4
|
||||
/* Avoid overflows on 32 bit systems */
|
||||
if (tmp > (ulonglong) ~(ulong) 0)
|
||||
if (option_limits)
|
||||
tmp= (ulong) fix_unsigned(thd, tmp, option_limits);
|
||||
#if SIZEOF_LONG < SIZEOF_LONG_LONG
|
||||
else if (tmp > ULONG_MAX)
|
||||
{
|
||||
truncated= true;
|
||||
llstr(tmp, buf);
|
||||
tmp= ((ulonglong) ~(ulong) 0);
|
||||
tmp= ULONG_MAX;
|
||||
throw_bounds_warning(thd, name, var->save_result.ulonglong_value);
|
||||
}
|
||||
#endif
|
||||
if (truncated)
|
||||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
|
||||
ER_TRUNCATED_WRONG_VALUE,
|
||||
ER(ER_TRUNCATED_WRONG_VALUE), name,
|
||||
buf);
|
||||
|
||||
if (option_limits)
|
||||
tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);
|
||||
if (var->type == OPT_GLOBAL)
|
||||
global_system_variables.*offset= (ulong) tmp;
|
||||
else
|
||||
thd->variables.*offset= (ulong) tmp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1259,7 +1296,7 @@ bool sys_var_thd_ha_rows::update(THD *thd, set_var *var)
|
|||
tmp= max_system_variables.*offset;
|
||||
|
||||
if (option_limits)
|
||||
tmp= (ha_rows) getopt_ull_limit_value(tmp, option_limits);
|
||||
tmp= (ha_rows) fix_unsigned(thd, tmp, option_limits);
|
||||
if (var->type == OPT_GLOBAL)
|
||||
{
|
||||
/* Lock is needed to make things safe on 32 bit systems */
|
||||
|
|
@ -1295,6 +1332,11 @@ uchar *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type,
|
|||
return (uchar*) &(thd->variables.*offset);
|
||||
}
|
||||
|
||||
bool sys_var_thd_ulonglong::check(THD *thd, set_var *var)
|
||||
{
|
||||
return get_unsigned(thd, var);
|
||||
}
|
||||
|
||||
bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
|
||||
{
|
||||
ulonglong tmp= var->save_result.ulonglong_value;
|
||||
|
|
@ -1303,7 +1345,7 @@ bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
|
|||
tmp= max_system_variables.*offset;
|
||||
|
||||
if (option_limits)
|
||||
tmp= getopt_ull_limit_value(tmp, option_limits);
|
||||
tmp= fix_unsigned(thd, tmp, option_limits);
|
||||
if (var->type == OPT_GLOBAL)
|
||||
{
|
||||
/* Lock is needed to make things safe on 32 bit systems */
|
||||
|
|
@ -1510,7 +1552,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
|
|||
pthread_mutex_lock(&LOCK_global_system_variables);
|
||||
value= *(ha_rows*) value_ptr(thd, var_type, base);
|
||||
pthread_mutex_unlock(&LOCK_global_system_variables);
|
||||
return new Item_int((longlong) value);
|
||||
return new Item_int((ulonglong) value);
|
||||
}
|
||||
case SHOW_MY_BOOL:
|
||||
{
|
||||
|
|
@ -2028,7 +2070,7 @@ bool sys_var_key_buffer_size::update(THD *thd, set_var *var)
|
|||
}
|
||||
|
||||
key_cache->param_buff_size=
|
||||
(ulonglong) getopt_ull_limit_value(tmp, option_limits);
|
||||
(ulonglong) fix_unsigned(thd, tmp, option_limits);
|
||||
|
||||
/* If key cache didn't existed initialize it, else resize it */
|
||||
key_cache->in_init= 1;
|
||||
|
|
@ -2076,7 +2118,7 @@ bool sys_var_key_cache_long::update(THD *thd, set_var *var)
|
|||
goto end;
|
||||
|
||||
*((ulong*) (((char*) key_cache) + offset))=
|
||||
(ulong) getopt_ull_limit_value(tmp, option_limits);
|
||||
(ulong) fix_unsigned(thd, tmp, option_limits);
|
||||
|
||||
/*
|
||||
Don't create a new key cache if it didn't exist
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue