:: DEVELOPER ZONE
Each MyISAM index (.MYI)
file has a counter in the header that can be used to check whether
a table has been closed properly. If you get the following warning
from CHECK TABLE or
myisamchk, it means that this counter has gone
out of sync:
clients are using or haven't closed the table properly
This warning doesn't necessarily mean that the table is corrupted, but you should at least check the table to verify that it's okay.
The counter works as follows:
The first time a table is updated in MySQL, a counter in the header of the index files is incremented.
The counter is not changed during further updates.
When the last instance of a table is closed (because of a
FLUSH TABLES operation or because there isn't
room in the table cache), the counter is decremented if the table
has been updated at any point.
When you repair the table or check the table and it is found to be okay, the counter is reset to zero.
To avoid problems with interaction with other processes that might check the table, the counter is not decremented on close if it was zero.
In other words, the counter can go out of sync only under these conditions:
The MyISAM tables are copied without a
preceding LOCK TABLES and FLUSH
TABLES.
MySQL has crashed between an update and the final close. (Note that the table may still be okay, because MySQL always issues writes for everything between each statement.)
A table was modified by myisamchk --recover or myisamchk --update-state at the same time that it was in use by mysqld.
Many mysqld servers are using the table and one
server performed a REPAIR TABLE or
CHECK TABLE on the table while it was in use by
another server. In this setup, it is safe to use CHECK
TABLE, although you might get the warning from other
servers. However, REPAIR TABLE should be
avoided because when one server replaces the data file with a new
one, this is not signaled to the other servers.
In general, it is a bad idea to share a data directory among multiple servers. See Section 5.11, “Running Multiple MySQL Servers on the Same Machine” for additional discussion.
© 1995-2005 MySQL AB. All rights reserved.

User Comments
Warning: query failed: Unknown column 'user.firstname' in 'field list' in /data0/sites/live/web-main/lib/mysql-cxn.php on line 69
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /data0/sites/live/web-main/lib/docbook.php on line 245
Add your own comment.