MySQL replication stopped due to crashed table (Error no 144)

Written by - 0 comments

Published on - Listed in MySQL Database Unix

Today I had to fix a MySQL replication, where the slave process suddenly stopped working. 

The show slave status output showed the following error:

Last_SQL_Errno: 144
Last_SQL_Error: Error 'Table './DB1/table_32' is marked as crashed and last (automatic?) repair failed' on query. Default database: 'DB1'. Query: 'ALTER TABLE table_32 DISABLE KEYS'

On a "normal" MySQL server I'd repair the table with myisamchk, but would this also work on the Slave? Yes it does.

cd /var/lib/mysql/DB1/

myisamchk table_32
Checking MyISAM file: table_32
Data records:       0   Deleted blocks:       0
myisamchk: warning: Table is marked as crashed and last repair failed
- check file-size
myisamchk: warning: Size of indexfile is: 2189487104      Should be: 1024
- check record delete-chain
- check key delete-chain
- check index reference
- check data record references index: 1
MyISAM-table 'table_32' is usable but should be fixed

So that's pretty much the same result as also seen in the replication status error. The table can be repaired with the -r parameter:

myisamchk -r table_32        
- recovering (with sort) MyISAM-table 'table_32'
Data records: 0
- Fixing index 1
- Fixing index 2
- Fixing index 3
- Fixing index 4
Data records: 36841845

Afterwards the slave process was started again:


And it worked again:

mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Slave_IO_Running: Yes
Slave_SQL_Running: Yes

Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.