【问题】
有同事反馈我们改造过的MySQL5.7.23版本,使用pt-table-checksum工具比较主从数据库的一致性时报错
Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. REPLACE... SELECT is unsafe because the order in which rows are retrieved by the SELECT determines which (if any) rows are replaced. This order cannot be predicted and may differ on master and the slave.
这个问题隐藏的比较深,经过反复测试,终于定位到原因了。
【pt-table-checksum工具的关键处理流程】
1、 pt-table-checksum工具有一部分处理逻辑,对于binlog_format为ROW模式的复制,会在master和slave上设置binlog_format=STATEMENT,确保从库也会执行 checksum SQL
2、