mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
Fixed a bug in DROP DATABASE when database had a RAID type table.
Bug ID 381.
This commit is contained in:
@ -1,3 +1,6 @@
|
||||
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,
|
||||
|
@ -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,
|
||||
|
@ -4722,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);
|
||||
|
@ -592,7 +592,7 @@ 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;
|
||||
(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,
|
||||
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
|
||||
|
Reference in New Issue
Block a user