Commit c9c58417 authored by jani@hynda.(none)'s avatar jani@hynda.(none)

- Fixed a bug in myisam_max_[extra]_sort_file_size, bug ID 339 and 342

- Fix for QNX: UNIX sockets available since 6.2.1
parent aa9bc9d0
......@@ -290,7 +290,6 @@ C_MODE_END
/* This has to be after include limits.h */
#define HAVE_ERRNO_AS_DEFINE
#define HAVE_FCNTL_LOCK
#undef HAVE_SYS_UN_H
#undef HAVE_FINITE
#undef HAVE_RINT
#undef LONGLONG_MIN /* These get wrongly defined in QNX 6.2 */
......
......@@ -108,17 +108,14 @@ show global variables like 'table_type';
Variable_name Value
table_type INNODB
set GLOBAL query_cache_size=100000;
set myisam_max_sort_file_size=10000, GLOBAL myisam_max_sort_file_size=20000;
show variables like 'myisam_max_sort_file_size';
Variable_name Value
myisam_max_sort_file_size 10000
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
Variable_name Value
myisam_max_sort_file_size 20000
set myisam_max_sort_file_size=default;
myisam_max_sort_file_size 1048576
set GLOBAL myisam_max_sort_file_size=default;
show variables like 'myisam_max_sort_file_size';
Variable_name Value
myisam_max_sort_file_size 20000
myisam_max_sort_file_size 2147483647
set global net_retry_count=10, session net_retry_count=10;
set global net_buffer_length=1024, net_write_timeout=200, net_read_timeout=300;
set session net_buffer_length=2048, net_write_timeout=500, net_read_timeout=600;
......@@ -211,6 +208,10 @@ set @@global.sql_auto_is_null=1;
Variable 'sql_auto_is_null' is a LOCAL variable and can't be used with SET GLOBAL
select @@global.sql_auto_is_null;
Variable 'sql_auto_is_null' is a LOCAL variable and can't be used with SET GLOBAL
set myisam_max_sort_file_size=100;
Variable 'myisam_max_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL
set myisam_max_extra_sort_file_size=100;
Variable 'myisam_max_extra_sort_file_size' is a GLOBAL variable and should be set with SET GLOBAL
set autocommit=1;
set big_tables=1;
select @@autocommit, @@big_tables;
......@@ -264,11 +265,11 @@ select @@max_user_connections;
@@max_user_connections
100
set global max_write_lock_count=100;
set myisam_max_extra_sort_file_size=100;
set global myisam_max_extra_sort_file_size=100;
select @@myisam_max_extra_sort_file_size;
@@myisam_max_extra_sort_file_size
100
set myisam_max_sort_file_size=100;
set global myisam_max_sort_file_size=100;
set myisam_sort_buffer_size=100;
set net_buffer_length=100;
set net_read_timeout=100;
......
......@@ -69,10 +69,9 @@ show local variables like 'table_type';
show global variables like 'table_type';
set GLOBAL query_cache_size=100000;
set myisam_max_sort_file_size=10000, GLOBAL myisam_max_sort_file_size=20000;
show variables like 'myisam_max_sort_file_size';
set GLOBAL myisam_max_sort_file_size=2000000;
show global variables like 'myisam_max_sort_file_size';
set myisam_max_sort_file_size=default;
set GLOBAL myisam_max_sort_file_size=default;
show variables like 'myisam_max_sort_file_size';
set global net_retry_count=10, session net_retry_count=10;
......@@ -137,6 +136,10 @@ set @@concurrent_insert=1;
set @@global.sql_auto_is_null=1;
--error 1228
select @@global.sql_auto_is_null;
--error 1229
set myisam_max_sort_file_size=100;
--error 1229
set myisam_max_extra_sort_file_size=100;
# Test setting all variables
......@@ -181,9 +184,9 @@ set max_tmp_tables=100;
set global max_user_connections=100;
select @@max_user_connections;
set global max_write_lock_count=100;
set myisam_max_extra_sort_file_size=100;
set global myisam_max_extra_sort_file_size=100;
select @@myisam_max_extra_sort_file_size;
set myisam_max_sort_file_size=100;
set global myisam_max_sort_file_size=100;
set myisam_sort_buffer_size=100;
set net_buffer_length=100;
set net_read_timeout=100;
......
......@@ -3839,12 +3839,13 @@ replicating a LOAD DATA INFILE command",
(gptr*) &global_system_variables.myisam_max_extra_sort_file_size,
(gptr*) &max_system_variables.myisam_max_extra_sort_file_size,
0, GET_ULL, REQUIRED_ARG, (ulonglong) MI_MAX_TEMP_LENGTH,
0, ~0L, 0, 1, 0},
0, (ulonglong) MAX_FILE_SIZE, 0, 1, 0},
{"myisam_max_sort_file_size", OPT_MYISAM_MAX_SORT_FILE_SIZE,
"Don't use the fast sort index method to created index if the temporary file would get bigger than this!",
(gptr*) &global_system_variables.myisam_max_sort_file_size,
(gptr*) &max_system_variables.myisam_max_sort_file_size, 0,
GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, ~0L, 0, 1024*1024, 0},
GET_ULL, REQUIRED_ARG, (longlong) LONG_MAX, 0, (ulonglong) MAX_FILE_SIZE,
0, 1024*1024, 0},
{"myisam_repair_threads", OPT_MYISAM_REPAIR_THREADS,
"Number of threads to use when repairing MyISAM tables. The value of 1 disables parallel repair.",
(gptr*) &global_system_variables.myisam_repair_threads,
......
......@@ -82,6 +82,8 @@ static void fix_net_retry_count(THD *thd, enum_var_type type);
static void fix_max_join_size(THD *thd, enum_var_type type);
static void fix_query_cache_size(THD *thd, enum_var_type type);
static void fix_key_buffer_size(THD *thd, enum_var_type type);
static void fix_myisam_max_extra_sort_file_size(THD *thd, enum_var_type type);
static void fix_myisam_max_sort_file_size(THD *thd, enum_var_type type);
/*
Variable definition list
......@@ -165,8 +167,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_thd_ulonglong sys_myisam_max_extra_sort_file_size("myisam_max_extra_sort_file_size", &SV::myisam_max_extra_sort_file_size);
sys_var_thd_ulonglong sys_myisam_max_sort_file_size("myisam_max_sort_file_size", &SV::myisam_max_sort_file_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);
sys_var_thd_ulong sys_myisam_sort_buffer_size("myisam_sort_buffer_size", &SV::myisam_sort_buff_size);
sys_var_thd_ulong sys_net_buffer_length("net_buffer_length",
......@@ -586,6 +588,21 @@ static void fix_low_priority_updates(THD *thd, enum_var_type type)
}
static void
fix_myisam_max_extra_sort_file_size(THD *thd, enum_var_type type)
{
myisam_max_extra_temp_length=
(my_off_t) global_system_variables.myisam_max_sort_file_size;
}
static void
fix_myisam_max_sort_file_size(THD *thd, enum_var_type type)
{
myisam_max_temp_length=
(my_off_t) global_system_variables.myisam_max_sort_file_size;
}
/*
Set the OPTION_BIG_SELECTS flag if max_join_size == HA_POS_ERROR
*/
......@@ -815,15 +832,22 @@ byte *sys_var_thd_ha_rows::value_ptr(THD *thd, enum_var_type type)
bool sys_var_thd_ulonglong::update(THD *thd, set_var *var)
{
ulonglong tmp= var->value->val_int();
if ((ulonglong) tmp > max_system_variables.*offset)
tmp= max_system_variables.*offset;
if (option_limits)
tmp= (ulong) getopt_ull_limit_value(tmp, option_limits);
if (var->type == OPT_GLOBAL)
{
/* Lock is needed to make things safe on 32 bit systems */
pthread_mutex_lock(&LOCK_global_system_variables);
global_system_variables.*offset= var->value->val_int();
global_system_variables.*offset= (ulonglong) tmp;
pthread_mutex_unlock(&LOCK_global_system_variables);
}
else
thd->variables.*offset= var->value->val_int();
thd->variables.*offset= (ulonglong) tmp;
return 0;
}
......
......@@ -233,13 +233,27 @@ class sys_var_thd_ulonglong :public sys_var_thd
{
public:
ulonglong SV::*offset;
bool only_global;
sys_var_thd_ulonglong(const char *name_arg, ulonglong SV::*offset_arg)
:sys_var_thd(name_arg), offset(offset_arg)
{}
sys_var_thd_ulonglong(const char *name_arg, ulonglong SV::*offset_arg,
sys_after_update_func func, bool only_global_arg)
:sys_var_thd(name_arg, func), offset(offset_arg),
only_global(only_global_arg)
{}
bool update(THD *thd, set_var *var);
void set_default(THD *thd, enum_var_type type);
SHOW_TYPE type() { return SHOW_LONGLONG; }
byte *value_ptr(THD *thd, enum_var_type type);
bool check_default(enum_var_type type)
{
return type == OPT_GLOBAL && !option_limits;
}
bool check_type(enum_var_type type)
{
return (only_global && type != OPT_GLOBAL);
}
};
......
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