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.