Commit d4b296b6 authored by unknown's avatar unknown

Merge gbichot@bk-internal.mysql.com:/home/bk/mysql-maria

into  gbichot4.local:/home/mysql_src/mysql-maria-for-undo-phase
parents 78c22772 32680d62
......@@ -203,6 +203,7 @@ double my_strtod(const char *str, char **end, int *error);
double my_atof(const char *nptr);
extern char *llstr(longlong value,char *buff);
extern char *ullstr(longlong value,char *buff);
#ifndef HAVE_STRTOUL
extern long strtol(const char *str, char **ptr, int base);
extern ulong strtoul(const char *str, char **ptr, int base);
......
......@@ -141,9 +141,9 @@ set GLOBAL myisam_max_sort_file_size=2000000;
show global variables 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;
--replace_result 2147482624 FILE_SIZE 9223372036853727232 FILE_SIZE
--replace_result 2146435072 FILE_SIZE 9223372036853727232 FILE_SIZE
show variables like 'myisam_max_sort_file_size';
--replace_result 2147482624 FILE_SIZE 9223372036853727232 FILE_SIZE
--replace_result 2146435072 FILE_SIZE 9223372036853727232 FILE_SIZE
select * from information_schema.session_variables where variable_name like 'myisam_max_sort_file_size';
set global net_retry_count=10, session net_retry_count=10;
......
......@@ -20,14 +20,6 @@
#include <mysys_err.h>
#include <my_getopt.h>
#if SIZEOF_LONG < SIZEOF_LONG_LONG
#define getopt_ul getopt_ll
#define getopt_ul_limit_value getopt_ll_limit_value
#else
#define getopt_ul getopt_ull
#define getopt_ul_limit_value getopt_ull_limit_value
#endif
static void default_reporter(enum loglevel level, const char *format, ...);
my_error_reporter my_getopt_error_reporter= &default_reporter;
......@@ -602,14 +594,16 @@ static int setval(const struct my_option *opts, uchar* *value, char *argument,
*((my_bool*) result_pos)= (my_bool) atoi(argument) != 0;
break;
case GET_INT:
case GET_UINT: /* fall through */
*((int*) result_pos)= (int) getopt_ll(argument, opts, &err);
break;
case GET_UINT:
*((uint*) result_pos)= (uint) getopt_ull(argument, opts, &err);
break;
case GET_LONG:
*((long*) result_pos)= (long) getopt_ll(argument, opts, &err);
break;
case GET_ULONG:
*((long*) result_pos)= (long) getopt_ul(argument, opts, &err);
*((long*) result_pos)= (long) getopt_ull(argument, opts, &err);
break;
case GET_LL:
*((longlong*) result_pos)= getopt_ll(argument, opts, &err);
......@@ -781,13 +775,19 @@ static longlong getopt_ll_limit_value(longlong num,
const struct my_option *optp)
{
ulonglong block_size= (optp->block_size ? (ulonglong) optp->block_size : 1L);
longlong old= num;
char buf1[255] __attribute__((unused)), buf2[255] __attribute__((unused));
if (num > 0 && (ulonglong) num > (ulonglong) optp->max_value &&
optp->max_value) /* if max value is not set -> no upper limit */
num= (ulonglong) optp->max_value;
num= ((num - optp->sub_size) / block_size);
num= (longlong) (num * block_size);
return max(num, optp->min_value);
num= max(num, optp->min_value);
if (num != old)
DBUG_PRINT("options", ("option '%s' adjusted %s -> %s",
optp->name, llstr(old, buf1), llstr(num, buf2)));
return num;
}
/*
......@@ -806,6 +806,9 @@ static ulonglong getopt_ull(char *arg, const struct my_option *optp, int *err)
ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp)
{
ulonglong old= num;
char buf1[255] __attribute__((unused)), buf2[255] __attribute__((unused));
if ((ulonglong) num > (ulonglong) optp->max_value &&
optp->max_value) /* if max value is not set -> no upper limit */
num= (ulonglong) optp->max_value;
......@@ -816,6 +819,9 @@ ulonglong getopt_ull_limit_value(ulonglong num, const struct my_option *optp)
}
if (num < (ulonglong) optp->min_value)
num= (ulonglong) optp->min_value;
if (num != old)
DBUG_PRINT("options", ("option '%s' adjusted %s -> %s",
optp->name, ullstr(old, buf1), ullstr(num, buf2)));
return num;
}
......@@ -872,7 +878,7 @@ static void init_one_value(const struct my_option *optp, uchar* *variable,
*((int*) variable)= (int) getopt_ll_limit_value(value, optp);
break;
case GET_UINT:
*((uint*) variable)= (uint) getopt_ll_limit_value(value, optp);
*((uint*) variable)= (uint) getopt_ull_limit_value(value, optp);
break;
case GET_ENUM:
*((uint*) variable)= (uint) value;
......@@ -881,7 +887,7 @@ static void init_one_value(const struct my_option *optp, uchar* *variable,
*((long*) variable)= (long) getopt_ll_limit_value(value, optp);
break;
case GET_ULONG:
*((ulong*) variable)= (ulong) getopt_ul_limit_value(value, optp);
*((ulong*) variable)= (ulong) getopt_ull_limit_value(value, optp);
break;
case GET_LL:
*((longlong*) variable)= (longlong) getopt_ll_limit_value(value, optp);
......
......@@ -32,3 +32,10 @@ char *llstr(longlong value,char *buff)
longlong10_to_str(value,buff,-10);
return buff;
}
char *ullstr(longlong value,char *buff)
{
longlong10_to_str(value,buff,10);
return buff;
}
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