Bug#31177: Server variables can't be set to their current values

additional fixes for 64-bit
---
Merge mysql.com:/misc/mysql/31177/50-31177
into  mysql.com:/misc/mysql/31177/51-31177
---
Bug#31177: Server variables can't be set to their current values

additional 5.1 fixes (for plugins)
parent 2cc07b28
...@@ -141,7 +141,7 @@ set GLOBAL myisam_max_sort_file_size=2000000; ...@@ -141,7 +141,7 @@ set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size'; show global variables like 'myisam_max_sort_file_size';
select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size'; select * from information_schema.global_variables where variable_name like 'myisam_max_sort_file_size';
set GLOBAL myisam_max_sort_file_size=default; set GLOBAL myisam_max_sort_file_size=default;
--replace_result 2147483647 FILE_SIZE 2146435072 FILE_SIZE --replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
show variables like 'myisam_max_sort_file_size'; show variables like 'myisam_max_sort_file_size';
--replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE --replace_result 2147483647 FILE_SIZE 9223372036854775807 FILE_SIZE
select * from information_schema.session_variables where variable_name like 'myisam_max_sort_file_size'; select * from information_schema.session_variables where variable_name like 'myisam_max_sort_file_size';
......
...@@ -867,7 +867,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, ...@@ -867,7 +867,7 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
bool *fix) bool *fix)
{ {
bool adjusted= FALSE; bool adjusted= FALSE;
ulonglong old= num, mod; ulonglong old= num;
char buf1[255], buf2[255]; char buf1[255], buf2[255];
if ((ulonglong) num > (ulonglong) optp->max_value && if ((ulonglong) num > (ulonglong) optp->max_value &&
...@@ -892,6 +892,8 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp, ...@@ -892,6 +892,8 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp,
num= ((ulonglong) ULONG_MAX); num= ((ulonglong) ULONG_MAX);
adjusted= TRUE; adjusted= TRUE;
} }
#else
num= min(num, LONG_MAX);
#endif #endif
break; break;
default: default:
......
...@@ -1880,7 +1880,13 @@ static int check_func_int(THD *thd, struct st_mysql_sys_var *var, ...@@ -1880,7 +1880,13 @@ static int check_func_int(THD *thd, struct st_mysql_sys_var *var,
struct my_option options; struct my_option options;
value->val_int(value, &tmp); value->val_int(value, &tmp);
plugin_opt_set_limits(&options, var); plugin_opt_set_limits(&options, var);
*(int *)save= (int) getopt_ull_limit_value(tmp, &options, &fixed);
if (var->flags & PLUGIN_VAR_UNSIGNED)
*(uint *)save= (uint) getopt_ull_limit_value((ulonglong) tmp, &options,
&fixed);
else
*(int *)save= (int) getopt_ll_limit_value(tmp, &options, &fixed);
if (fixed) if (fixed)
{ {
char buf[22]; char buf[22];
...@@ -1902,7 +1908,13 @@ static int check_func_long(THD *thd, struct st_mysql_sys_var *var, ...@@ -1902,7 +1908,13 @@ static int check_func_long(THD *thd, struct st_mysql_sys_var *var,
struct my_option options; struct my_option options;
value->val_int(value, &tmp); value->val_int(value, &tmp);
plugin_opt_set_limits(&options, var); plugin_opt_set_limits(&options, var);
*(long *)save= (long) getopt_ull_limit_value(tmp, &options, &fixed);
if (var->flags & PLUGIN_VAR_UNSIGNED)
*(ulong *)save= (ulong) getopt_ull_limit_value((ulonglong) tmp, &options,
&fixed);
else
*(long *)save= (long) getopt_ll_limit_value(tmp, &options, &fixed);
if (fixed) if (fixed)
{ {
char buf[22]; char buf[22];
...@@ -1925,6 +1937,13 @@ static int check_func_longlong(THD *thd, struct st_mysql_sys_var *var, ...@@ -1925,6 +1937,13 @@ static int check_func_longlong(THD *thd, struct st_mysql_sys_var *var,
value->val_int(value, &tmp); value->val_int(value, &tmp);
plugin_opt_set_limits(&options, var); plugin_opt_set_limits(&options, var);
*(ulonglong *)save= getopt_ull_limit_value(tmp, &options, &fixed); *(ulonglong *)save= getopt_ull_limit_value(tmp, &options, &fixed);
if (var->flags & PLUGIN_VAR_UNSIGNED)
*(ulonglong *)save= getopt_ull_limit_value((ulonglong) tmp, &options,
&fixed);
else
*(longlong *)save= getopt_ll_limit_value(tmp, &options, &fixed);
if (fixed) if (fixed)
{ {
char buf[22]; char buf[22];
......
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