diff options
-rw-r--r-- | mysql-test/r/drop.result | 5 | ||||
-rw-r--r-- | mysql-test/t/drop.test | 13 | ||||
-rw-r--r-- | sql/sql_db.cc | 1 | ||||
-rw-r--r-- | sql/sql_table.cc | 5 | ||||
-rw-r--r-- | sql/table.h | 1 |
5 files changed, 23 insertions, 2 deletions
diff --git a/mysql-test/r/drop.result b/mysql-test/r/drop.result index ff11905aa34..4626dd580f7 100644 --- a/mysql-test/r/drop.result +++ b/mysql-test/r/drop.result @@ -85,3 +85,8 @@ select 1; 1 unlock tables; End of 5.0 tests +create database mysql_test; +create table mysql_test.t1(f1 int); +create table mysql_test.`#sql-347f_7` (f1 int); +drop database mysql_test; +End of 5.1 tests diff --git a/mysql-test/t/drop.test b/mysql-test/t/drop.test index a1451773e90..a79044436eb 100644 --- a/mysql-test/t/drop.test +++ b/mysql-test/t/drop.test @@ -122,3 +122,16 @@ disconnect addconroot2; connection default; --echo End of 5.0 tests + +# +# Bug#30152 MySQLD crash duing alter table causes DROP DATABASE to FAIL due to temp file +# +create database mysql_test; +create table mysql_test.t1(f1 int); +create table mysql_test.`#sql-347f_7` (f1 int); +create table mysql_test.`#sql-347f_8` (f1 int); +drop table mysql_test.`#sql-347f_8`; +copy_file $MYSQLTEST_VARDIR/master-data/mysql_test/t1.frm $MYSQLTEST_VARDIR/master-data/mysql_test/#sql-347f_6.frm; +drop database mysql_test; + +--echo End of 5.1 tests diff --git a/sql/sql_db.cc b/sql/sql_db.cc index abbf2131957..88902e65a42 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -1111,6 +1111,7 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp, const char *db, VOID(filename_to_tablename(file->name, table_list->table_name, strlen(file->name) + 1)); table_list->alias= table_list->table_name; // If lower_case_table_names=2 + table_list->internal_tmp_table= is_prefix(file->name, tmp_file_prefix); /* Link into list */ (*tot_list_next)= table_list; tot_list_next= &table_list->next_local; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index bf15968f09b..75c97d8edd4 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1663,8 +1663,9 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, } alias= (lower_case_table_names == 2) ? table->alias : table->table_name; /* remove .frm file and engine files */ - path_length= build_table_filename(path, sizeof(path), - db, alias, reg_ext, 0); + path_length= build_table_filename(path, sizeof(path), db, alias, reg_ext, + table->internal_tmp_table ? + FN_IS_TMP : 0); } if (drop_temporary || (table_type == NULL && diff --git a/sql/table.h b/sql/table.h index 2bbd71b70c6..440f3a3d5cf 100644 --- a/sql/table.h +++ b/sql/table.h @@ -1081,6 +1081,7 @@ struct TABLE_LIST ... SELECT implementation). */ bool create; + bool internal_tmp_table; /* View creation context. */ |