Bug #24631 DD files aren't deleted when stopped node started again
Submitted: 27 Nov 2006 19:57 Modified: 23 May 2007 15:50
Reporter: Serge Kozlov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Cluster: Disk Data Severity:S2 (Serious)
Version:5.1.14-bk OS:Linux (Linux FC4)
Assigned to: Jonas Oreland

[27 Nov 2006 19:57] Serge Kozlov
Description:
Cluster has two data node and NoOfReplicas=2.
Log file group and tablespace are created when both node are running.
One data node is stopped and then tablespace and log file group are dropped. In fact proper files are removed from worked node only.
But when stopped node starts again these files aren't removed. 

How to repeat:
1. Start a cluster based on two data nodes and NoOfReplicas=2
2. Create logfile group and tablespace:

mysql> create logfile group lg1 add undofile 'undofile.dat' initial_size 20M un
do_buffer_size 1M engine=ndb;
Query OK, 0 rows affected (9.82 sec)

mysql> create tablespace ts1 add datafile 'datafile.dat' use logfile group lg1
initial_size 10M engine=ndb;
Query OK, 0 rows affected (6.48 sec)

3. Make sure that both pairs are created:
[ndbdev@localhost user]$ ls -la /space/run/ndb_?_fs/ | grep "^[-|/]"
/space/run/ndb_2_fs/:
-rw-rw-r--  1 ndbdev ndbdev 10551296 Nov 27 20:26 datafile.dat
-rw-rw-r--  1 ndbdev ndbdev 20971520 Nov 27 20:26 undofile.dat
/space/run/ndb_3_fs/:
-rw-rw-r--  1 ndbdev ndbdev 10551296 Nov 27 20:26 datafile.dat
-rw-rw-r--  1 ndbdev ndbdev 20971520 Nov 27 20:26 undofile.dat

4. Now run ndb_mgm and stop one data node:

ndb_mgm> 3 stop
Node 3: Node shutdown initiated
Node 3: Node shutdown completed.
Node 3 has shutdown.

ndb_mgm>

5. Start mysql client and remove logfile group and tablespace

mysql> alter tablespace ts1 drop datafile 'datafile.dat' engine=ndb;
Query OK, 0 rows affected (0.50 sec)

mysql> drop tablespace ts1 engine=ndb; e
Query OK, 0 rows affected (0.50 sec)

mysql> drop  logfile group lg1 engine=ndb; e
Query OK, 0 rows affected (1.53 sec)

6. Make sure that files are removed for running data node:

[ndbdev@localhost user]$ ls -la /space/run/ndb_?_fs/ | grep "^[-|/]"
/space/run/ndb_2_fs/:
/space/run/ndb_3_fs/:
-rw-rw-r--  1 ndbdev ndbdev 10551296 Nov 27 20:26 datafile.dat
-rw-rw-r--  1 ndbdev ndbdev 20971520 Nov 27 20:26 undofile.dat

7. Start stopped data node and make sure that node started successfully.

8. Getting list of files in data node directories:

[ndbdev@localhost user]$ ls -la /space/run/ndb_?_fs/ | grep "^[-|/]"
/space/run/ndb_2_fs/:
/space/run/ndb_3_fs/:
-rw-rw-r--  1 ndbdev ndbdev 10551296 Nov 27 20:26 datafile.dat
-rw-rw-r--  1 ndbdev ndbdev 20971520 Nov 27 20:26 undofile.dat

9. Now unable to create logfile group and tablespace on these files because one node contains their.

Suggested fix:
At least this behavior should be documented
[27 Nov 2006 23:56] Jonathan Miller
A better question is should we allow DDL operations when there is a data node missing out of the cluster, or should we simply return an error stating that this is not aloowed on partial clusters?

/jeb
[28 Nov 2006 0:12] Jonas Oreland
should be supported.
this is a bug
[15 May 2007 7: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/26668

ChangeSet@1.2517, 2007-05-15 09:08:16+02:00, jonas@perch.ndb.mysql.com +6 -0
  ndb - bug#24631
    add Dbdict::restartDropObj*
[23 May 2007 8:24] Bugs System
Pushed into 5.1.19-beta
[23 May 2007 15:50] Jon Stephens
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release.

If necessary, you can access the source repository and build the latest available version, including the bug fix. More information about accessing the source trees is available at

    http://dev.mysql.com/doc/en/installing-source.html

Documented bugfix in 5.1.19 changelog, added note to the 5.1 Manual discussion of partial starts.
[10 Oct 2008 11:36] 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/56020

2995 Jonas Oreland	2008-10-10
      ndb - 6.4 - testDict -n Bug24631 T1
        Make sure that CREATE_OLD_PASS and DROP_OLD_PASS does not overwrite
          master state
        (and fix bugs found while testing it)