Take a look at this:

The sort order is obviously wrong while CHECK TABLE is not reporting any error

Why ? Because CHECK TABLE only looks at MyISAM data and Index files and it does not compare information in these to table definition (.frm file)

In this particular case I replaced .frm file for the table from different one changing INT to UNSIGNED INT to see what effect it will give – as you can see you get quite funny table which is considered OK by CHECK TABLE, which does store values larger than max signed int but which sorts them as unsigned ints. Quite fun.

I hope the task of fixing this is somewhere on MySQL roadmap 🙂

6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
hartmut

Hi Peter,

is there a bug report for this already or should we create one?

Pat

How’s check table even going to if there’s an error here w/o carrying a second copy of the metadata in the MYD file? Seems like he can only reasonably be expected to compare the data in the MYD with the data in the FRM and if they look consistent all is well.

If you spoof the metadata like this, I think that qualifies as an event the product can’t reasonably be expected to recover from. Like going out and deleting the binary log from the file system and then opening a bug that replication is broken.

James Aylett

You can detect this situation to some extent by having some kind of hash of the frm in the myd/myi files. On the other hand, you can always break systems by messing directly with their internal files, so I wouldn’t argue that this is as important as perhaps providing tools for managing rollback/restore of these files as a group. Or just telling you not to do that sort of thing 🙂

kissimmee vacation homes

I wanted to thank you for this excellent read!! I definitely loved every little bit of it.Cheers for the info!!!! & This is the perfect blog for anyone who wants to know about this topic. You know so much its almost hard to argue with you ………
thanks