[alibaba/canal]canal v1.1.7不支持mysql 8.0.33的binlog,Decoding Query的候报错java.io.IOException: Read Q_HRNOW error: limit excceed: 65

2024-07-22 292 views
1

版本信息:

  • canal 版本:canal.deployer-1.1.7.tar.gz
  • mysql 版本:percona xtradb cluster 8.0.33-25 问题描述: 无法正确解析binglog,Decoding Query的时候报错java.io.IOException: Read Q_HRNOW error: limit excceed: 65 希官方对该版本的binlog兼容,谢谢啦! 补充说明:canal.deployer-1.1.7.tar.gz + pxc 8.0.30-22 相同配置可以正常解析binlog

详细报错信息 2023-11-08 08:34:16.753 [destination = cms , address = /192.168.199.11:33066 , EventParser] WARN com.taobao.tddl.dbsync.binlog.LogDecoder - Decoding Query failed from: bin-log.003032:4 java.io.IOException: Read Q_HRNOW error: limit excceed: 65 at com.taobao.tddl.dbsync.binlog.event.QueryLogEvent.unpackVariables(QueryLogEvent.java:750) at com.taobao.tddl.dbsync.binlog.event.QueryLogEvent.(QueryLogEvent.java:499) at com.taobao.tddl.dbsync.binlog.event.QueryLogEvent.(QueryLogEvent.java:442) at com.taobao.tddl.dbsync.binlog.LogDecoder.decode(LogDecoder.java:196) at com.taobao.tddl.dbsync.binlog.LogDecoder.decode(LogDecoder.java:82) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.seek(MysqlConnection.java:153) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findAsPerTimestampInSpecificLogFile(MysqlEventParser.java:775) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findByStartTimeStamp(MysqlEventParser.java:600) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPositionInternal(MysqlEventParser.java:522) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPosition(MysqlEventParser.java:360) at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$1.run(AbstractEventParser.java:186) at java.lang.Thread.run(Thread.java:750) Caused by: java.lang.IllegalArgumentException: limit excceed: 65 at com.taobao.tddl.dbsync.binlog.LogBuffer.forward(LogBuffer.java:130) at com.taobao.tddl.dbsync.binlog.event.QueryLogEvent.unpackVariables(QueryLogEvent.java:718) ... 11 common frames omitted 2023-11-08 08:34:16.753 [destination = cms , address = /192.168.199.11:33066 , EventParser] ERROR c.a.o.c.p.inbound.mysql.rds.RdsBinlogEventParserProxy - ERROR ## findAsPerTimestampInSpecificLogFile has an error java.io.IOException: Read Q_HRNOW error: limit excceed: 65 at com.taobao.tddl.dbsync.binlog.event.QueryLogEvent.unpackVariables(QueryLogEvent.java:750) at com.taobao.tddl.dbsync.binlog.event.QueryLogEvent.(QueryLogEvent.java:499) at com.taobao.tddl.dbsync.binlog.event.QueryLogEvent.(QueryLogEvent.java:442) at com.taobao.tddl.dbsync.binlog.LogDecoder.decode(LogDecoder.java:196) at com.taobao.tddl.dbsync.binlog.LogDecoder.decode(LogDecoder.java:82) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlConnection.seek(MysqlConnection.java:153) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findAsPerTimestampInSpecificLogFile(MysqlEventParser.java:775) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findByStartTimeStamp(MysqlEventParser.java:600) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPositionInternal(MysqlEventParser.java:522) at com.alibaba.otter.canal.parse.inbound.mysql.MysqlEventParser.findStartPosition(MysqlEventParser.java:360) at com.alibaba.otter.canal.parse.inbound.AbstractEventParser$1.run(AbstractEventParser.java:186) at java.lang.Thread.run(Thread.java:750) Caused by: java.lang.IllegalArgumentException: limit excceed: 65 at com.taobao.tddl.dbsync.binlog.LogBuffer.forward(LogBuffer.java:130) at com.taobao.tddl.dbsync.binlog.event.QueryLogEvent.unpackVariables(QueryLogEvent.java:718) ... 11 common frames omitted

回答

7

两个版本的mysql binlog配置一致,具体如下: 参数项 无法解析的8.0.33 可正常解析的8.0.30 binlog_cache_size 2097152 2097152 binlog_checksum CRC32 CRC32 binlog_ddl_skip_rewrite OFF OFF binlog_direct_non_transactional_updates OFF OFF binlog_encryption OFF OFF binlog_error_action ABORT_SERVER ABORT_SERVER binlog_expire_logs_auto_purge ON ON binlog_expire_logs_seconds 604800 604800 binlog_format ROW ROW binlog_group_commit_sync_delay 0 0 binlog_group_commit_sync_no_delay_count 0 0 binlog_gtid_simple_recovery ON ON binlog_max_flush_queue_time 0 0 binlog_order_commits ON ON binlog_rotate_encryption_master_key_at_startup OFF OFF binlog_row_event_max_size 8192 8192 binlog_row_image FULL FULL binlog_row_metadata MINIMAL MINIMAL binlog_row_value_options
binlog_rows_query_log_events ON ON binlog_skip_flush_commands OFF OFF binlog_space_limit 0 0 binlog_stmt_cache_size 32768 32768 binlog_transaction_compression OFF OFF binlog_transaction_compression_level_zstd 3 3 binlog_transaction_dependency_history_size 25000 25000 binlog_transaction_dependency_tracking COMMIT_ORDER COMMIT_ORDER

0
  1. 这个是percona,不是mysql原版
  2. percona扩展了自己的一些binlog格式,与之前兼容的mariadb版本有冲突,还不太好做适配兼容
8

@e345 先看一下这个版本修复,验证下percona

2

非常感谢,马上验证下 ^_^
percona确实做得好,有些功能原版的mysql,mariadb做不到。有劳费心啦

3

@agapple 您好! 8.0.33终于测通,同步数据没有报错了。 后续再观察下,马上准备升级到8.0.34,有问题再继续反馈。

期间的小问题解决过程和一个小建议: 1、为了确保兼容新代码,Percona源码重新编译指定了: -DCOMPILATION_COMMENT="Percona XtraDB Cluster ${MysqlVer} by e345"。 确保 select @@version_comment 可以获取到“Percona”特征。 2、MysqlConnection.java加了段logger.warn调试输出,建议源代码按此commit调整下,便于运行时及时发现问题。 提交了一个pull request,可以审核参考:https://github.com/alibaba/canal/pull/4943

0

如果不加-DCOMPILATION_COMMENT,默认的comment是啥行为?

9

如果用二进制的,一般包含Percona特征,但通过Percona源码编译的默认是“Source distribution”,除非指定。 据说mysql新版让version_comment支持读写了,如果可以在my.cnf配置那就省事多了。

5

如果有其他更好的识别percona、mariadb、mysql的机制,也可以反馈给我

4

目前version_comment是相对规范可控的办法,当然如果能够在Decoding binlog第一条的时候进行binlog自适应判断,从binlog格式层面去自适应那是最好的,第一条decode确定好类型后,然后批量跑。

好消息:pxc 8.0.34-26, mysql 8.0.34运行没有报错,数据同步正常。