Description:
Consider the following test case:
mysql> CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undofile.dat' INITIAL_SIZE 16M UNDO_BUFFER_SIZE = 1M ENGINE=NDB;
Query OK, 0 rows affected (1.65 sec)
mysql> CREATE TABLESPACE ts2 ADD DATAFILE 'datafile.dat' USE LOGFILE GROUP lg1 INITIAL_SIZE 12M ENGINE NDB;
Query OK, 0 rows affected (1.72 sec)
mysql> create database mysqltest;
Query OK, 1 row affected (0.00 sec)
mysql> CREATE TABLE mysqltest.t1 (c1 INT, c2 DOUBLE, c3 FLOAT, c4 TIMESTAMP, c5 TEXT, c6 LONGBLOB, c7 CHAR, c8 MEDIUMINT AUTO_INCREMENT, c9 BIT(8), c10 DECIMAL(10,2), c11 char(10), c12 VARCHAR(150), PRIMARY KEY (c8)) TABLESPACE ts2 STORAGE DISK ENGINE=NDB;
Query OK, 0 rows affected (1.04 sec)
mysql> drop tablespace ts2 engine = ndb;
ERROR 1503 (HY000): Failed to drop TABLESPACE
mysql> alter tablespace ts2 drop datafile 'datafile.dat' engine = ndb;
Query OK, 0 rows affected (0.14 sec)
mysql> drop tablespace ts2 engine = ndb;
ERROR 1503 (HY000): Failed to drop TABLESPACE
mysql> CREATE TABLESPACE ts2 ADD DATAFILE 'datafile.dat' USE LOGFILE GROUP lg1 INITIAL_SIZE 12M ENGINE NDB; ERROR 1502 (HY000): Failed to create TABLESPACE
***
So now it won't let me drop the table space . But if we look at the file system we see that the file is gone.
/space/run/ndb_4_fs> ls
D1 D10 D11 D2 D8 D9 LCP undofile.dat
/space/run/ndb_5_fs> ls
D1 D10 D11 D2 D8 D9 LCP undofile.dat
And I can still drop my table (GOOD)
mysql> use mysqltest
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+---------------------+
| Tables_in_mysqltest |
+---------------------+
| t1 |
+---------------------+
1 row in set (0.01 sec)
mysql> drop table t1;
Query OK, 0 rows affected (0.69 sec)
But I still can not drop the table space:
mysql> drop tablespace ts2 engine = ndb;
ERROR 1503 (HY000): Failed to drop TABLESPACE
Yet if I restart the whole cluster, then it will allow the drop.
mysql> drop tablespace ts2 engine = ndb; Query OK, 0 rows affected (0.13 sec)
How to repeat:
See Above
Suggested fix:
Should not have to restart cluster to drop invalid Table Space.