Bug #381 Dropping a database containing RAID TABLEs does not work in 4.0.12
Submitted: 6 May 2003 10:33 Modified: 13 May 2003 12:19
Reporter: Miguel Solorzano Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.12 OS:Unix
Assigned to: Jani Tolonen CPU Architecture:Any

[6 May 2003 10:33] Miguel Solorzano
Description:
From the mysql client a database can't be dropped.
The error reported:
"perror 39" is "Directory not empty"
After issued the command is verified that actually the directory isn't
empty.

However using the mysqladmin tool the database is dropped:

mysqladmin drop <database>

How to repeat:
mysql> create database test;
Query OK, 1 row affected (0.00 sec)
  
mysql> use test;
Database changed
mysql> create table foo (x int) RAID_TYPE=1;
Query OK, 0 rows affected (0.00 sec)
  
mysql> drop database test;
ERROR 1010: Error dropping database (can't rmdir './test', errno: 39)
[10 May 2003 11:25] Tõnu Samuel
I think this must work now:

===== mysql-test/r/raid.result 1.4 vs edited =====
--- 1.4/mysql-test/r/raid.result        Thu Oct 11 03:59:44 2001
+++ edited/mysql-test/r/raid.result     Sat May 10 21:14:08 2003
@@ -1,3 +1,6 @@
+show variables like "have_raid";
+Variable_name  Value
+have_raid      YES
 DROP TABLE IF EXISTS t1,t2;
 CREATE TABLE t1 (
 id int unsigned not null auto_increment primary key,
@@ -194,3 +197,8 @@
 count(*)
 450
 DROP TABLE t2;
+create database test_raid;
+use test_raid;
+create table foo (x int) RAID_TYPE=1;
+drop database test_raid;
+use test;
===== mysql-test/t/raid.test 1.3 vs edited =====
--- 1.3/mysql-test/t/raid.test  Thu Oct 11 03:59:42 2001
+++ edited/mysql-test/t/raid.test       Sat May 10 21:17:26 2003
@@ -193,3 +193,13 @@
 ALTER TABLE t2 CHANGE COLUMN c c VARCHAR(251) NOT NULL;
 select count(*) from t2;
 DROP TABLE t2;
+
+# Bugreport 381 http://bugs.mysql.com/bug.php?id=381
+
+create database test_raid;
+use test_raid;
+create table foo (x int) RAID_TYPE=1;
+drop database test_raid;
+use test;
+
+
===== sql/sql_db.cc 1.59 vs edited =====
--- 1.59/sql/sql_db.cc  Tue Apr 29 14:21:27 2003
+++ edited/sql/sql_db.cc        Sat May 10 20:49:51 2003
@@ -240,6 +240,8 @@
          DBUG_RETURN(-1);
        }
       }
+      /* This MUST be here or DROP DATABASE will not work with RAID tables in it */
+      found_other_files++;
       continue;
     }
     if (find_type(fn_ext(file->name),&deletable_extentions,1+2) <= 0)
[13 May 2003 12:19] Michael Widenius
Thank you for your bug report. This issue has been fixed in the latest
development tree for that product. You can find more information about
accessing our development trees at 
    http://www.mysql.com/doc/en/Installing_source_tree.html