Cannot Create Table ‘./database/table.frm’ on Cluster
June 7th, 2008Recently, I was getting a very strange error on my mySQL cluster. It kept telling me two things! When issuing:
alter table X engine=ndbcluster;
I would get:
Cannot Create Table ‘./database/#[a-zA-Z0-9]’ (155)
Interesting - I thought to myself.
This seemed both annoying and un-helpful and googling led me nowhere. So I persisted in trying to work out what the hell was going wrong, however, this interesting little error led me to follow a new way of thinking, as when I issued the command:
CREATE TABLE `group` (
`group_id` int(7) NOT NULL AUTO_INCREMENT,
`group_name` varchar(255) DEFAULT NULL,
PRIMARY KEY (`group_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8
I got the error:
Table ‘group’ already exists.
Well, it didn’t exist, but this did give me a really good idea as to what was going on. Since, previously I was able to do this no problems and since the cluster was - as far as I knew, operating fine - and I was creating a table with an InnoDB engine, it didn’t make sense that the two errors happened to happen at the same time.
The answer lies in the ndb_mgm console, and issuing:
ndb_mgm> show
Gave me the answer - plain as day.
Connected to Management Server at: host.name.here:1186
Cluster Configuration
———————
[ndbd(NDB)] 2 node(s)
id=2 @host.name.here (Version: 5.0.32, Nodegroup: 0, Master)
id=3 @host.name.here (Version: 5.0.32, Nodegroup: 0)[ndb_mgmd(MGM)] 1 node(s)
id=1 @host.name.here (Version: 5.0.32)[mysqld(API)] 2 node(s)
id=4 (not connected, accepting connect from host.name.here)
id=5 @host.name.here (Version: 5.0.32)
Now, I’m not entirely sure why - but, as soon as I issued a restart on the mysqld, and it reconnected all of my issues went away. I could create new tables on any engine and alter tables to NDB.
The interesting thing that I have yet to have answered, is why when an API disappeared from the cluster but all of the storage nodes were there, why the cluster suddenly had issues. Very weird, none the less, it fixed my problems.