I simply dropped the table and then tried to recreate it, from that point on I have not been able to create a new InnoDB table with the same name in that database.
I have since created the table under a different name and tried renaming it as well as simplifying the table schema to the following:
Code:
CREATE TABLE `trade_messages` (
`tmid` bigint(20) NOT NULL auto_increment,
`appQueryCompletionTimeStamp` datetime default NULL,
PRIMARY KEY (`tmid`)
) ENGINE=InnoDB;
Heres a few further tests:
Code:
mysql> CREATE TABLE `trade_messages2` (
-> `tmid` bigint(20) NOT NULL auto_increment,
-> `appQueryCompletionTimeStamp` datetime default NULL,
-> PRIMARY KEY (`tmid`)
-> ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.03 sec)
mysql> ALTER TABLE trade_messages2 RENAME TO trade_messages;
ERROR 1025 (HY000): Error on rename of './trade_engine_log/trade_messages2' to './trade_engine_log/trade_messages' (errno: 121)
mysql> SET FOREIGN_KEY_CHECKS=0;
Query OK, 0 rows affected (0.00 sec)
mysql> ALTER TABLE trade_messages2 RENAME TO trade_messages;
ERROR 1025 (HY000): Error on rename of './trade_engine_log/trade_messages2' to './trade_engine_log/trade_messages' (errno: 121)
mysql> alter table trade_messages2 disable keys;
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> DROP TABLE trade_messages;
ERROR 1051 (42S02): Unknown table 'trade_messages'
mysql> CREATE TABLE `trade_messages` (
-> `tmid` bigint(20) NOT NULL auto_increment,
-> `appQueryCompletionTimeStamp` datetime default NULL,
-> PRIMARY KEY (`tmid`)
-> ) ENGINE=InnoDB;
ERROR 1005 (HY000): Can't create table './trade_engine_log/trade_messages.frm' (errno: 121)
I just found the following post:
http://forums.mysql.com/read.php?22,...6181#msg-76181
"errno 121 means a duplicate key error. Probably the table already exists in the InnoDB internal data dictionary, though the .frm file for the table has been deleted. This is the most common reason for getting errno 121 in table creation. Another possible reason is a name conflict in a foreign key constraint name. Constraint names must be unique in a database, like table names are. "
Looking at some of the errors in my log the error is exactly that. So the DROP TABLE must have failed to completely remove its internal cache.
Code:
080501 0:29:51 InnoDB: Error: table `trade_engine_log/trade_messages` already exists in InnoDB internal
InnoDB: data dictionary. Have you deleted the .frm file
InnoDB: and not used DROP TABLE? Have you used DROP DATABASE
InnoDB: for InnoDB tables in MySQL version <= 3.23.43?
InnoDB: See the Restrictions section of the InnoDB manual.
InnoDB: You can drop the orphaned table inside InnoDB by
InnoDB: creating an InnoDB table with the same name in another
InnoDB: database and copying the .frm file to the current database.
InnoDB: Then MySQL thinks the table exists, and DROP TABLE will
InnoDB: succeed.
InnoDB: You can look for further help from
InnoDB: http://dev.mysql.com/doc/refman/5.0/en/innodb-troubleshooting.html
I'm also looking through "http://www.innodb.com/support/tips/fic-recovery/" this atm.
Bookmarks