Commit c4d32704 authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Merge bk-internal.mysql.com:/home/bk/mysql-4.0

into narttu.mysql.fi:/my/mysql-4.0
parents d9aa9563 f0a2ca1a
......@@ -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 */
......
create database test_raid;
create table test_raid.r1 (i int) raid_type=1;
drop database test_raid;
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (
id int unsigned not null auto_increment primary key,
......
......@@ -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;
......
......@@ -5,6 +5,9 @@ show variables like "have_raid";
# Test of raided tables
#
create database test_raid;
create table test_raid.r1 (i int) raid_type=1;
drop database test_raid;
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (
id int unsigned not null auto_increment primary key,
......
......@@ -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,
......@@ -4721,11 +4722,9 @@ static void get_options(int argc,char **argv)
my_disable_locking= myisam_single_user= test(opt_external_locking == 0);
my_default_record_cache_size=global_system_variables.read_buff_size;
myisam_max_temp_length=
(my_off_t) min(global_system_variables.myisam_max_sort_file_size,
(ulonglong) MAX_FILE_SIZE);
(my_off_t) global_system_variables.myisam_max_sort_file_size;
myisam_max_extra_temp_length=
(my_off_t) min(global_system_variables.myisam_max_extra_sort_file_size,
(ulonglong) MAX_FILE_SIZE);
(my_off_t) global_system_variables.myisam_max_extra_sort_file_size;
/* Set global variables based on startup options */
myisam_block_size=(uint) 1 << my_bit_log2(opt_myisam_block_size);
......
......@@ -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_extra_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);
}
};
......
......@@ -211,6 +211,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
ulong found_other_files=0;
char filePath[FN_REFLEN];
TABLE_LIST *tot_list=0, **tot_list_next;
List<String> raid_dirs;
DBUG_ENTER("mysql_rm_known_files");
DBUG_PRINT("enter",("path: %s", org_path));
......@@ -229,6 +231,8 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
{
char newpath[FN_REFLEN];
MY_DIR *new_dirp;
String *dir;
strxmov(newpath,org_path,"/",file->name,NullS);
unpack_filename(newpath,newpath);
if ((new_dirp = my_dir(newpath,MYF(MY_DONT_SORT))))
......@@ -239,7 +243,11 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
my_dirend(dirp);
DBUG_RETURN(-1);
}
raid_dirs.push_back(dir=new String(newpath));
dir->copy();
continue;
}
found_other_files++;
continue;
}
if (find_type(fn_ext(file->name),&deletable_extentions,1+2) <= 0)
......@@ -278,12 +286,19 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db,
deleted++;
}
}
my_dirend(dirp);
if (thd->killed ||
(tot_list && mysql_rm_table_part2_with_lock(thd, tot_list, 1, 1)))
{
my_dirend(dirp);
DBUG_RETURN(-1);
}
List_iterator<String> it(raid_dirs);
String *dir;
while ((dir= it++))
if (rmdir(dir->c_ptr()) < 0)
found_other_files++;
my_dirend(dirp);
/*
If the directory is a symbolic link, remove the link first, then
remove the directory the symbolic link pointed at
......
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