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

Fixed a bug in DROP DATABASE when database had a RAID type table.

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