mysql5.7 X protocol_MySQL 5.7slave_compressed_protocol参数导致复制bug

使用MySQL5.7的半同步复制时,发现主库一个简单的写操作会执行1s,通过show profile分析是半同步导致。

查看主从日志,发现报错如下:

主库报错:

2018-05-21T05:34:06.955592Z 0 [ERROR] /usr/local/mysql-5.7.21-linux-glibc2.12-x86_64/bin/mysqld: Got an error reading communication packets

2018-05-21T05:34:06.967776Z 21 [Note] While initializing dump thread for slave with UUID <26b1280d-2125-11e8-b5a8-005056ac3676>, found a zombie dump thread with the same UUID. Master is killing the zombie dump thread(20).

2018-05-21T05:34:06.967864Z 20 [Note] Stop semi-sync binlog_dump to slave (server_id: 12233306)

2018-05-21T05:34:06.967954Z 21 [Note] Start binlog_dump to master_thread_id(21) slave_server(12233306), pos(mysql-bin.000004, 484)

2018-05-21T05:34:07.957450Z 21 [Note] Start semi-sync binlog_dump to slave (server_id: 12233306), pos(mysql-bin.000004, 484)

从库报错

2018-05-21T05:54:29.787788Z 4 [ERROR] Error reading packet from server for channel ‘‘: Lost connection to MySQL server during query (server_errno=2013)

2018-05-21T05:54:29.787880Z 4 [Note] Slave I/O thread: Failed reading log event, reconnecting to retry, log ‘mysql-bin.000004‘ at position 484 for channel ‘‘

2018-05-21T05:54:29.787908Z 4 [Warning] Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the ‘START SLAVE Syntax‘ in the MySQL Manual for more information.

经过初步分析,只有半同步才会触发该问题,那么应该是从库返回的ACK包出现bug,主库无法解析,最后经过调整参数,确认半同步下,只有从库开启参数slave_compressed_protocol才会出现该问题,官方默认参数为OFF。

即出问题的条件,a.5.7 b.从库slave_compressed_protocol=1 c.主从半同步

该问题确认为5.7bug,已经有人提了,不过网上的案例还是很少。

https://bugs.mysql.com/bug.php?id=85382

上实验图:

正常

9877826bd165ae7173592784363de70c.png

daae1e5cbcc93f62ab14effaff024617.png

触发bug

f76bb6484741f0de3c0b6b2bde8ddc69.png

e2082300b0b85e55894486a624b2ae42.png解决办法:从库设置slave_compressed_protocol=0(5.7还不是很成熟啊.....)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值