GNU Info

Info Node: (mysql.info)MyISAM table close

(mysql.info)MyISAM table close


Prev: Corrupted MyISAM tables Up: MyISAM table problems
Enter node , (file) or (file)node

Clients is using or hasn't closed the table properly
....................................................

Each `MyISAM' `.MYI' file has in the header a counter that can be used
to check if a table has been closed properly.

If you get the following warning from `CHECK TABLE' or `myisamchk':

     # clients is using or hasn't closed the table properly

this means that this counter has come out of sync.  This doesn't mean
that the table is corrupted, but means that you should at least do a
check on the table to verify that it's ok.

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'
     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 was ok, the
     counter is reset to 0.

   * To avoid problems with interaction with other processes that may
     do a check on the table, the counter is not decremented on close
     if it was 0.

In other words, the only ways this can go out of sync are:

   * The `MyISAM' tables are copied without a `LOCK' and `FLUSH TABLES'.

   * MySQL has crashed between an update and the final close (Note that
     the table may still be ok, as MySQL always issues writes for
     everything between each statement).

   * Someone has done a `myisamchk --repair' or `myisamchk
     --update-state'on a table that was in use by `mysqld'.

   * Many `mysqld' servers are using the table and one has done a
     `REPAIR' or `CHECK' of the table while it was in use by another
     server.  In this setup the `CHECK' is safe to do (even if you will
     get the warning from other servers), but `REPAIR' should be
     avoided as it currently replaces the data file with a new one,
     which is not signaled to the other servers.


automatically generated by info2www version 1.2.2.9