Crash Recover Specific Table

In the event of a database crash being caused by specific table a warning message like the below might appear :

InnoDB: space name ./mboxgroup29/open_conversation.ibd,
InnoDB: which is outside the tablespace bounds.
InnoDB: Byte offset 0, len 16384, i/o type 10.
InnoDB: If you get this error at mysqld startup, please check that 
InnoDB: your my.cnf matches the ibdata files that you have in the
InnoDB: MySQL server. 
101012 16:33:25InnoDB: Assertion failure in thread 1161918816 in file fil0fil.c line 3959
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: about forcing recovery.
101012 16:33:25 - mysqld got signal 11;
This could be because you hit a bug. It is also possible that this binary 
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

Sometimes dropping all the databases or dropping that specific database might not be an option because of the number of users residing under mail_item. Also this would make sense if the error is not under mail_item, in that case we do not want to be dumping and writing huge amounts of data.

1. Stop mailbox

 zmmailboxdctl stop

2. Dump that specific table, in the above example "open_conversation" as open_conversation.sql

source ~/bin/zmshutil ; zmsetvars
~/mysql/bin/mysqldump mboxgroup29 --table open_conversation -S $mysql_socket -u root --password=$mysql_root_password > /tmp/open_conversation.sql

3. Rename existing table open_conversation to open_conversation_old

$ mysql mboxgroup29
mysql> rename table open_conversation to open_conversation_old;

4. Edit the open_conversation to open_conversation_new in the open_conversation.sql.

Note: Make sure you string match and replace the table name. The constraint names must also be updated.

5. Restore open_conversation.sql file

mysql mboxgroup29 < /tmp/open_conversation.sql

6. This will result in the recreated table showing up as "open_conversation_new

7. Rename the table open_convesation_new to open_convesation.

$ mysql mboxgroup29
mysql> rename table open_conversation_new to open_conversation;

8. Restart services and check for errors again under mysql_error.log

If this does not help then you might want to look at :
Jump to: navigation, search