Bug #56622 add better messages for stray .frm file
Submitted: 7 Sep 2010 16:40
Reporter: Axel Schwenke Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Cluster: Cluster (NDB) storage engine Severity:S4 (Feature request)
Version:mysql-5.1-telco-7.1 OS:Any
Assigned to: Assigned Account CPU Architecture:Any
Tags: 5.1.44-ndb-7.1.4

[7 Sep 2010 16:40] Axel Schwenke
Description:
Sometimes it may happen that a stray .frm file is found on an SQL node. Then a table is shown in i.e. SHOW TABLES, but accessing the table will yield an error along

ERROR 1146 (42S02): Table 'foo.bar' doesn't exist

There is a much better message from InnoDB:

InnoDB: Cannot find table test/child2 from the internal data dictionary
InnoDB: of InnoDB though the .frm file for the table exists. Maybe you
InnoDB: have deleted and recreated InnoDB data files but have forgotten
InnoDB: to delete the corresponding .frm files of InnoDB tables?

How to repeat:
Create a NDB table, copy the .frm to a safe place, drop the table and copy the .frm back. The table will be shown existent, but access will fail. There seems to be no way to get rid of that .frm file from SQL level.

Suggested fix:
Add better diagnostics. Currently NDB is the only engine besides InnoDB that has its own data dictionary. Maybe this could be solved in an engine independent way?