We have a MySql 5.5 database running InnoDB on Linux. One table (named table_search) is running MyISAM to be able to perform full text searches. The table has 823 368 rows.
Yesterday we had a server crash, to get it back up again we moved the raw data to a new server and now we are running on the new server.
It worked fine at first, but after an hour we got something like this in the error logs:
1. Duplicate entry 'X-Y-Z' for key index_titles (where index_titles is an index in table_search)
2. After this there where lots of errors: Incorrect key file for table './database/table_search.MYI'; try to repair it
3. After this there where lots of errors: Table './database/table_search' is marked as crashed and should be repaired
We tried to repair it by using:
myisamchk table_search.MYI
We got error like this:
myisamchk: error: Keypointers and record positions doesn't match
MyISAM-table 'table_search.MYI' is corrupted
Then we tried:
myisamchk -r -o table_search.MYI
Now everything was working again until an hour ago when the same thing happened again. So we used myisamchk again and it is working.
But it doesn't feel that stable as it happened again. What can we do to make sure it won't happen again? Why is it corrupted? What is the solution?
The solution was something else. We had restarted the server using:
(sorry for not mentioning this in the question)
By this document at MySql we learned that:
This was the solution:
Now the server has been running fine for almost 24 hours.
This sounds as your table is corrupted and is beyond what myisamchk is able to recover.
I guess your best try is to recover the table from a backup or, if only your search index is affected, re-create and re-populate this table.