现象:
目前线上有套基于MySQL 8.0.26做的增强半同步主从复制数据库,查看log_errorr发现有部分net_flush()执行失败的报错:
2021-12-28T14:04:24.663005+08:00 11 [ERROR] [MY-011161] [Repl] Semi-sync master failed on net_flush() before waiting for replica reply.
2021-12-28T14:51:49.217811+08:00 413824 [ERROR] [MY-011161] [Repl] Semi-sync master failed on net_flush() before waiting for replica reply.
2022-07-15T14:53:48.661852+08:00 14621647 [ERROR] [MY-011161] [Repl] Semi-sync master failed on net_flush() before waiting for replica reply.
2022-11-15T16:35:27.219541+08:00 1479506 [ERROR] [MY-011161] [Repl] Semi-sync master failed on net_flush() before waiting for replica reply.
2022-11-15T17:15:12.815920+08:00 1558519 [ERROR] [MY-011161] [Repl] Semi-sync master failed on net_flush() before waiting for replica reply.
2022-11-15T19:32:27.765331+08:00 1567874 [ERROR] [MY-011161] [Repl] Semi-sync master failed on net_flush() before waiting for replica reply.
2022-11-15T20:17:57.104040+08:00 1570576 [ERROR] [MY-011161] [Repl] Semi-sync master failed on net_flush() before waiting for replica reply.
2022-11-16T20:51:59.230221+08:00 1571592 [ERROR] [MY-011161] [Repl] Semi-sync master failed on net_flush() before waiting for replica reply.
MySQL增强半同步master端在等待slave端reply前执行net_flush()失败,而根据业务反馈没有影响业务。
MySQL 8.0搜索关于net_flush()的BUG:
MySQL 8.0没有关于net_flush()的BUG。
查看MySQL 5.7关于net_flush()的BUG:
查看MySQL提交的BUG内容:
https://bugs.mysql.com/bug.php?id=88578
大致意思是,在MySQL 5.7可能会因为网络不稳定导致:半同步复制的master端在得到slave端reply前执行net_flush(0)失败。
在MySQL 5.7和MariaDB 10版本会造成slave端“IO Thread”挂起:
参考案例:https://blog.51cto.com/hcymysql/2146955