MySQL table is marked as crashed and should be repaired
Problem
The following appears in the atlassian-confluence.log
:
org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getHotReferrers' in class com.atlassian.confluence.pages.actions.PageInfoAction threw exception class org.springframework.jdbc.UncategorizedSQLException : (Hibernate operation): encountered SQLException [Table './confluencedb/EXTRNLNKS' is marked as crashed and should be repaired]; nested exception is java.sql.SQLException: Table './confluencedb/EXTRNLNKS' is marked as crashed and should be repaired
at org.apache.velocity.runtime.parser.node.PropertyExecutor.execute(PropertyExecutor.java:188)
at org.apache.velocity.runtime.parser.node.ASTIdentifier.execute(ASTIdentifier.java:226)
at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:207)
at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:357)
Cause
Often after running out of disk space or a similar unexpected event, some of the database tables may have become corrupt. This often occurs after you experience out of disk space problems on the disk partition where your database resides. In the above example the EXTRNLNKS
table became corrupt and needs to be repaired.
Resolution
The corrupted tables need to be repaired. Please see:
- MySQL documentation on How to Repair MyISAM Tables and REPAIR TABLE Syntax.
- There is also a third-party but comprehensive article on how to repair mysql database corruption at http://www.databasejournal.com/features/mysql/article.php/3300511.
If those do not help, you may need to consider restoring from a backup.
Please note that the solution can be applied to any other product that is stumbling on a similar table corruption issue (related to MySQL DB).