导读
semi-sync插件崩溃导致MySQL重启的故障分析全过程~
作者:刘安
现为爱可生高级测试工程师,拥有丰富的自动测试开发经验;曾先后在文思海辉、Splunk担任测试工程师。
一、起因:
在公司测试MySQL高可用组件时发现一个异常。如下:
停止从库,高可用组件将从库自动启动后,主库发生了重启。然而,正常情况下,主库不应发生重启。
二、环境:
1、OS: CentOS release 6.7 (Final);
2、MySQL:Ver 14.14 Distrib 5.7.13, for linux-glibc2.5 (x86_64) using EditLine wrapper;
3、主从实例开启半同步 MySQL semi-sync配置文档。
三、分析:
(一)首先,分析log文件:
在主库的mysql-error.log中,我们可以发现如下几点:
1、主库的semi-sync在崩溃前做了启停动作:
2017-07-25T16:02:38.636061+08:00 40 [Note] Semi-sync replication switched OFF.
2017-07-25T16:02:38.636105+08:00 40 [Note] Semi-sync replication disabled on the master.
2017-07-25T16:02:38.636137+08:00 0 [Note] Stopping ack receiver thread
2017-07-25T16:02:38.638008+08:00 40 [Note] Semi-sync replication enabled on the master.
2017-07-25T16:02:38.638131+08:00 0 [Note] Starting ack receiver thread
2、主库的semi-sync启动后,立即引发了semi-sync插件崩溃并抛出Assert异常。
mysqld: /export/home/pb2/build/sb_0-19016729-1464157976.67/mysql-5.7.13/plugin/semisync/semisync_master.cc:844: int ReplSemiSyncMaster::commitTrx(const char*, my_off_t): Assertion `entry' failed.
08:02:38 UTC - mysqld got