.TMM and .TMD files MySQL
Par PlaceOweb le dimanche, mai 1 2011, 10:29 - SQL - Lien permanent
What are .TMM and .TMD files under MySQL ?
With a full disk, and "OPTIMIZE TABLE `log-slow`" not finished, i obtain file .TMM under my database for my "log-slow" MyISAM table ....
-rw-rw---- 1 mysql mysql 65 sep 10 2010 db.opt -rw-rw---- 1 mysql mysql 8848 avr 1 10:36 log@002dslow.frm -rw-rw---- 1 mysql mysql 25425965468 mai 2 05:05 log@002dslow.MYD -rw-rw---- 1 mysql mysql 1407971328 mai 2 07:55 log@002dslow.MYI -rw-rw---- 1 mysql mysql 578867200 mai 2 11:23 log@002dslow.TMM
mysql> show processlist; +-------+------------------+---------------------+------------------+------------+-------+-------------------+------------------------------------------------------------------------------------------------------+ | Id | User | Host | db | Command | Time | State | Info | +-------+------------------+---------------------+------------------+------------+-------+-------------------+------------------------------------------------------------------------------------------------------+ | 18002 | mysql | localhost | mysql_log_parser | Query | 13165 | Sorting index | OPTIMIZE TABLE `log-slow` | | 18012 | mysql_log_parser | 192.168.30.15:59501 | mysql_log_parser | Query | 9291 | Waiting for table | INSERT INTO `log-slow` (id,User,Host,Query_time,Lock_time,Rows_sent,Rows_examined,Time,Query) VALUES | | 18013 | mysql_log_parser | 192.168.30.15:59503 | mysql_log_parser | Query | 9231 | Waiting for table | INSERT INTO `log-slow` (id,User,Host,Query_time,Lock_time,Rows_sent,Rows_examined,Time,Query) VALUES | | 18812 | root | localhost | mysql_log_parser | Query | 905 | Waiting for table | TRUNCATE `log-slow` | | 18827 | root | localhost | mysql_log_parser | Field List | 18 | Waiting for table | | | 18828 | root | localhost | NULL | Query | 0 | NULL | show processlist | +-------+------------------+---------------------+------------------+------------+-------+-------------------+------------------------------------------------------------------------------------------------------+
While repairing table with "REPAIR TABLE `log-slow`", .TMD file appear :
-rw-rw---- 1 mysql mysql 65 sep 10 2010 db.opt -rw-rw---- 1 mysql mysql 8848 avr 1 10:36 log@002dslow.frm -rw-rw---- 1 mysql mysql 25425965468 mai 2 05:05 log@002dslow.MYD -rw-rw---- 1 mysql mysql 1407971328 mai 2 11:37 log@002dslow.MYI -rw-rw---- 1 mysql mysql 160550912 mai 2 12:02 log@002dslow.TMD
mysql> show processlist; +-------+------------+----------------------+------------------------+---------+------+-------------------+-------------------------+ | Id | User | Host | db | Command | Time | State | Info | +-------+------------+----------------------+------------------------+---------+------+-------------------+-------------------------+ | 18889 | root | localhost | mysql_log_parser | Query | 31 | Repair by sorting | REPAIR TABLE `log-slow` | | 18890 | root | localhost | NULL | Query | 0 | NULL | show processlist | +-------+------------+----------------------+------------------------+---------+------+-------------------+-------------------------+
But repair with disk full don't work... I don't need data of this table, that's for i finaly decide to destroy all data of this table with "rm log-slow.MYD" on file system.
mysql> select * from `log-slow`; ERROR 144 (HY000): Table './mysql_log_parser/log@002dslow' is marked as crashed and last (automatic?) repair failed mysql> REPAIR TABLE `log-slow`; +---------------------------+--------+----------+-------------------------------------------------------------------+ | Table | Op | Msg_type | Msg_text | +---------------------------+--------+----------+-------------------------------------------------------------------+ | mysql_log_parser.log-slow | repair | Error | File './mysql_log_parser/log@002dslow.MYD' not found (Errcode: 2) | | mysql_log_parser.log-slow | repair | Error | Can't find file: 'log-slow' (errno: 2) | | mysql_log_parser.log-slow | repair | error | Corrupt | +---------------------------+--------+----------+-------------------------------------------------------------------+ 3 rows in set (0.00 sec) mysql> truncate table `log-slow`; Query OK, 0 rows affected (0.97 sec) mysql> REPAIR TABLE `log-slow`; +---------------------------+--------+----------+----------+ | Table | Op | Msg_type | Msg_text | +---------------------------+--------+----------+----------+ | mysql_log_parser.log-slow | repair | status | OK | +---------------------------+--------+----------+----------+ 1 row in set (0.00 sec)
I finally view normal files :
-rw-rw---- 1 mysql mysql 65 sep 10 2010 db.opt -rw-rw---- 1 mysql mysql 8848 avr 1 10:36 log@002dslow.frm -rw-rw---- 1 mysql mysql 0 mai 2 12:51 log@002dslow.MYD -rw-rw---- 1 mysql mysql 2048 mai 2 12:51 log@002dslow.MYI