Bug #34036 Ndb temporary table ids are not reused at system restart
Submitted: 24 Jan 2008 14:57 Modified: 30 Apr 2009 3:48
Reporter: Martin Skold Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S3 (Non-critical)
Version:mysql-5.1-telco-7.0 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: ndb_table_temporary

[24 Jan 2008 14:57] Martin Skold
Description:
If a temporary table is created in ndb followed by
a non-temporary table then table id's are not
reused correctly when a new table is created
after system restart.

How to repeat:
mysql> set ndb_table_temporary=1;
Query OK, 0 rows affected (0.00 sec)

mysql> create table t1(a int not null, b int, c char(10) not null, unique (c)) engine = ndb;
Query OK, 0 rows affected (0.30 sec)
mysql> set ndb_table_temporary=0;
Query OK, 0 rows affected (0.00 sec)

mysql> create table t1a(a int not null, b int, c char(10) not null, unique (c)) engine = ndb;
Query OK, 0 rows affected (1.24 sec)

shell> storage/ndb/tools/ndb_show_tables --show-temp-status
*** restart cluster ***
shell> storage/ndb/tools/ndb_show_tables --show-temp-status

mysql> drop table t1;
ERROR 1051 (42S02): Unknown table 't1'
mysql> create table t1(a int not null, b int, c char(10) not null, unique (c)) engine = ndb;

shell> storage/ndb/tools/ndb_show_tables --show-temp-status

Suggested fix:
Clear table state for all temporary tables at restart.