以前的Blog被新浪封了,以後就寫在這裡了。
今天一個測試環境的Mysql忽然掛掉,其實Mysql是已經死掉了,但是ps仍能看到。Mysql的版本為5.0.38。
在Mysqld的Log裡輸出如下資訊:
1 121112 9:57:36InnoDB: Assertion failure in thread 1153980752 in file btr0cur.c line 3591 2 InnoDB: Failing assertion: extern_len >= part_len 3 InnoDB: We intentionally generate a memory trap. 4 InnoDB: Submit a detailed bug report to http://bugs.mysql.com. 5 InnoDB: If you get repeated assertion failures or crashes, even 6 InnoDB: immediately after the mysqld startup, there may be 7 InnoDB: corruption in the InnoDB tablespace. Please refer to 8 InnoDB: http://dev.mysql.com/doc/refman/5.0/en/forcing-recovery.html 9 InnoDB: about forcing recovery.10 121112 9:57:36 - mysqld got signal 11;11 This could be because you hit a bug. It is also possible that this binary12 or one of the libraries it was linked against is corrupt, improperly built,13 or misconfigured. This error can also be caused by malfunctioning hardware.14 We will try our best to scrape up some info that will hopefully help diagnose15 the problem, but since we have already crashed, something is definitely wrong16 and this may fail.17 18 key_buffer_size=838860019 read_buffer_size=13107220 max_used_connections=1421 max_connections=80022 threads_connected=1023 It is possible that mysqld could use up to24 key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 1748985 K25 bytes of memory26 Hope that's ok; if not, decrease some variables in the equation.27 28 thd=(nil)29 Attempting backtrace. You can use the following information to find out30 where mysqld died. If you see no messages after this, something went31 terribly wrong...32 frame pointer is NULL, did you compile with33 -fomit-frame-pointer? Aborting backtrace!34 The manual page at http://www.mysql.com/doc/en/Crashing.html contains35 information that should help you find out what is causing the crash.
當時反應就是Kill掉這個Mysqld,嘗試重啟,但是重啟仍然報錯,於是嘗試使用Mysql5.1和Mysql5.5啟動,仍不能解決問題,Mysql仍然是無法啟動成功。
這時候在Mysql裡設定
innodb_force_recovery=1
但是Mysqld的Log裡不列印Force Recovery的資訊,覺得不對勁,語句又仔細去觀察Mysqld的Log,發現Mysql是在APPLY Redo的時候掛掉,innodb_force_recovery=1是在Apply redo完成之後再進行Force Recovery,所以就沒有進入到Force Recovery環節,於是嘗試設定innodb_force_recovery=6,跳過Apply Redo,成功啟動,趕緊把所有表全部DUMP出來,然後又啟動一個新庫再倒入進去。正好對這個測試庫也升一下級。