Bug #20053 TABLESPACE should only be allowed to drop files that are created for that TS
Submitted: 24 May 2006 19:42 Modified: 3 Jul 2006 16:53
Reporter: Jonathan Miller Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Disk Data Severity:S2 (Serious)
Version:5.1.12 OS:Linux (Linux 32 Bit OS)
Assigned to: Jonas Oreland CPU Architecture:Any

[24 May 2006 19:42] Jonathan Miller
Description:
Hi,

If I have 2 table spaces (ts1 and ts2) I should not be allowed to drop files created under ts2 by using ts1 in the alter command.

mysql> CREATE TABLESPACE ts1 ADD DATAFILE 'datafile.dat' USE LOGFILE GROUP lg1 INITIAL_SIZE 12M ENGINE NDB;
Query OK, 0 rows affected (1.08 sec)

mysql> CREATE TABLESPACE ts2 ADD DATAFILE 'datafile2.dat' USE LOGFILE GROUP lg1 INITIAL_SIZE 12M ENGINE NDB;
Query OK, 0 rows affected (1.11 sec)

id    type                 state    logging database     schema   name
3     UserTable            Online   Yes     cluster      def      NDB$BLOB_2_3
1     SystemTable          Online   Yes     sys          def      NDB$EVENTS_0
5     LogfileGroup         Online   -                             lg1
10    Datafile             Online   -                             datafile2.dat
6     Undofile             Online   -                             undofile.dat
2     UserTable            Online   Yes     cluster      def      schema
4     UserTable            Online   Yes     cluster      def      apply_status
8     Datafile             Online   -                             datafile.dat
7     Tablespace           Online   -                             ts1
9     Tablespace           Online   -                             ts2
0     SystemTable          Online   Yes     sys          def      SYSTAB_0

mysql> ALTER TABLESPACE ts1 DROP DATAFILE 'datafile2.dat' ENGINE = NDB; Query OK, 0 rows affected (0.41 sec)

id    type                 state    logging database     schema   name
3     UserTable            Online   Yes     cluster      def      NDB$BLOB_2_3
1     SystemTable          Online   Yes     sys          def      NDB$EVENTS_0
5     LogfileGroup         Online   -                             lg1
6     Undofile             Online   -                             undofile.dat
2     UserTable            Online   Yes     cluster      def      schema
4     UserTable            Online   Yes     cluster      def      apply_status
8     Datafile             Online   -                             datafile.dat
7     Tablespace           Online   -                             ts1
9     Tablespace           Online   -                             ts2
0     SystemTable          Online   Yes     sys          def      SYSTAB_0

Notice that datafile2.dat is now gone.

How to repeat:
see above

Suggested fix:
Give me an error when I try to drop ts2's files using ts1 in the alter command
[26 Jun 2006 13:08] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/8243
[29 Jun 2006 9:55] Tomas Ulin
pushed to 5.1.12
[3 Jul 2006 16:53] Jon Stephens
Documented bugfix in 5.1.12 changelog. Closed.