Bug #31976 Can't drop a ndb table after all ndbds restarted
Submitted: 31 Oct 2007 8:36 Modified: 6 Nov 2007 10:39
Reporter: li zhou Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1 OS:Any
Assigned to: CPU Architecture:Any
Tags: 5.1.22

[31 Oct 2007 8:36] li zhou
Description:
Run mysql-test-run, then create a ndb table, insert data into table. 
We kill all the data nodes and then restart all the data nodes.
After do that we can insert, select from table, but can't drop and truncate the table.

How to repeat:
1:) run mysql-test-run.pl --start-and-exit --do-test=ndb
2:) create a ndb table t1 and insert data into it.
3:) kill all data nodes
4:) restart all data nodes. The result of ndb_mgm is correct.
5:) do "select * from t1", "insert into t1 values(....)" work well. but can't truncate and drop t1.
    mysql> select * from t2;
    +---+---+---+
    | a | b | c |
    +---+---+---+
    | 1 | 1 | 1 |
    | 2 | 2 | 2 |
    +---+---+---+
    2 rows in set (0.04 sec)

    mysql> select * from t1;
    +---+---+---+
    | a | b | c |
    +---+---+---+
    | 1 | 1 | 1 |
    | 2 | 2 | 2 |
    +---+---+---+
    2 rows in set (0.01 sec)

    mysql> drop table t1;
    ERROR 1051 (42S02): Unknown table 't1'
    mysql> truncate table t1;
    ERROR 1005 (HY000): Can't create table 'test.t1' (errno: 157)
    mysql> show warnings;
    +-------+------+-------------------------------------------+
    | Level | Code | Message                                   |
    +-------+------+-------------------------------------------+
    | Error | 1005 | Can't create table 'test.t1' (errno: 157) |
    +-------+------+-------------------------------------------+
    1 row in set (0.00 sec)

6:) after restart mysqld, all operation work well.
    mysql> select * from t1;
    +---+---+---+
    | a | b | c |
    +---+---+---+
    | 1 | 1 | 1 |
    | 2 | 2 | 2 |
    +---+---+---+
    2 rows in set (0.04 sec)
 
    mysql> select * from t2;
    +---+---+---+
    | a | b | c |
    +---+---+---+
    | 1 | 1 | 1 |
    | 2 | 2 | 2 |
    +---+---+---+
    2 rows in set (0.04 sec)

    mysql> truncate table t1;
    071030 16:49:27 [Note] NDB Binlog: CREATE TABLE Event: REPL$test/t1
    Query OK, 0 rows affected (1.47 sec)
 
    mysql> select * from t1;
    Empty set (0.01 sec)
 
    mysql> drop  table t2;
    Query OK, 0 rows affected (0.81 sec)

    mysql> exit
    NDB: Found 4 NdbTransaction's that have not been released
    NDB: Found 2 NdbReceiver's that have not been released

Suggested fix:
All operations should work well after data nodes restart.