开发者社区> 问答> 正文

canal有考虑事务回滚的Event吗

mysql的binlog文档在介绍XID_EVENT时有这么一段

XID_EVENT Generated for a commit of a transaction that modifies one or more tables of an XA-capable storage engine. Normal transactions are implemented by sending a QUERY_EVENT containing a BEGIN statement and a QUERY_EVENT containing a COMMIT statement (or a ROLLBACK statement if the transaction is rolled back).

但是我看canal1.24代码中解析QUERY_EVENT时,只考虑了BEGIN和COMMIT,并没有考虑ROLLBACK,请问这样做的原因是什么呢?

https://dev.mysql.com/doc/refman/5.7/en/innodb-and-mysql-replication.html 这里又有这么一段叙述:

Transactions that fail on the master do not affect replication at all. MySQL replication is based on the binary log where MySQL writes SQL statements that modify data. A transaction that fails (for example, because of a foreign key violation, or because it is rolled back) is not written to the binary log,

貌似并不会记录回滚的binlog...有没有特别清楚的人呢

原提问者GitHub用户whyliyu

展开
收起
绿子直子 2023-05-09 12:02:21 116 0
1 条回答
写回答
取消 提交回答
  • rollback不会记录binlog,只有提交的事务会记录

    原回答者GitHub用户agapple

    2023-05-10 10:28:02
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载