开发者社区> 问答> 正文

4.2.16版本,配置双向同步报IndexOutOfBoundsException,MySQL是ro

4.2.16版本,MySQL是row格式,报如下异常,经过排查是在处理retl_mark表时出现该异常 com.alibaba.otter.node.etl.select.exceptions.SelectException: java.lang.IndexOutOfBoundsException: Index: 0 at com.alibaba.otter.node.etl.select.selector.MessageParser.parse(MessageParser.java:212) ~[node.etl-4.2.16.jar:na] at com.alibaba.otter.node.etl.select.selector.canal.CanalEmbedSelector.selector(CanalEmbedSelector.java:278) ~[node.etl-4.2.16.jar:na] at com.alibaba.otter.node.etl.select.SelectTask.processSelect(SelectTask.java:236) [node.etl-4.2.16.jar:na] at com.alibaba.otter.node.etl.select.SelectTask.access$300(SelectTask.java:94) [node.etl-4.2.16.jar:na] at com.alibaba.otter.node.etl.select.SelectTask$1.run(SelectTask.java:208) [node.etl-4.2.16.jar:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_131] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [na:1.8.0_131] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_131] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_131] at java.lang.Thread.run(Thread.java:748) [na:1.8.0_131] Caused by: java.lang.IndexOutOfBoundsException: Index: 0 at java.util.Collections$EmptyList.get(Collections.java:4454) ~[na:1.8.0_131] at com.alibaba.otter.canal.protocol.CanalEntry$RowChange.getRowDatas(CanalEntry.java:8189) ~[canal.protocol-1.1.1.jar:na] at com.alibaba.otter.node.etl.select.selector.MessageParser.parse(MessageParser.java:110) ~[node.etl-4.2.16.jar:na] ... 9 common frames omitted 2018-11-16 15:05:24.111 [pipelineId = 6,taskName = ProcessSelect] WARN c.a.o.s.a.i.setl.zookeeper.termin.WarningTerminProcess - nid:2[6:setl:com.alibaba.otter.node.etl.select.exceptions.SelectException: java.lang.IndexOutOfBoundsException: Index: 0 at com.alibaba.otter.node.etl.select.selector.MessageParser.parse(MessageParser.java:212) at com.alibaba.otter.node.etl.select.selector.canal.CanalEmbedSelector.selector(CanalEmbedSelector.java:278) at com.alibaba.otter.node.etl.select.SelectTask.processSelect(SelectTask.java:236) at com.alibaba.otter.node.etl.select.SelectTask.access$300(SelectTask.java:94) at com.alibaba.otter.node.etl.select.SelectTask$1.run(SelectTask.java:208) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.IndexOutOfBoundsException: Index: 0 at java.util.Collections$EmptyList.get(Collections.java:4454) at com.alibaba.otter.canal.protocol.CanalEntry$RowChange.getRowDatas(CanalEntry.java:8189) at com.alibaba.otter.node.etl.select.selector.MessageParser.parse(MessageParser.java:110) ... 9 more 在MessageParser的110行增加if(rowChange.getRowDatasCount()>0)可以处理该异常,但是不知道这样处理是否有问题,修复代码如下 //修复BUG,增加判断 if(rowChange.getRowDatasCount()>0) { int loopback = checkLoopback(pipeline, rowChange.getRowDatas(0)); if (loopback == 2) { needLoopback |= true; // 只处理正常同步产生的回环数据 } isLoopback |= loopback > 0; }

+-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | INDEX | 1136 | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | PROCESS-ID | 1069 | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | GMT-CREATE | 2019-05-23 16:03:09 | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | COST(ms) | 0 | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | OBJECT | 0xc70fadd | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | CLASS | com.alibaba.otter.node.etl.select.selector.MessageParser | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | METHOD | parse | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | IS-RETURN | false | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | IS-EXCEPTION | true | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | PARAMETERS[0] | 41 | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | PARAMETERS[1] | [header { | | | version: 1 | | | logfileName: "mysql-bin.004555" | | | logfileOffset: 114450153 | | | serverId: 1336733066 | | | serverenCode: "UTF-8" | | | executeTime: 1558598497000 | | | sourceType: MYSQL | | | schemaName: "" | | | tableName: "" | | | eventLength: 68 | | | } | | | entryType: TRANSACTIONBEGIN | | | storeValue: " \237\250\201\002" | | | , header { | | | version: 1 | | | logfileName: "mysql-bin.004555" | | | logfileOffset: 114450221 | | | serverId: 1336733066 | | | serverenCode: "UTF-8" | | | executeTime: 1558598497000 | | | sourceType: MYSQL | | | schemaName: "" | | | tableName: "retl_mark" | | | eventLength: 140 | | | eventType: QUERY | | | } | | | entryType: ROWDATA | | | storeValue: "\020\aZtINSERT INTO retl.retl_mark (id, channel_id) VALUES (222, 38) ON DUPLICATE KEY UPDATE channel_id = VALUES(channel_id)" | | | ] | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | THROW-EXCEPTION | com.alibaba.otter.node.etl.select.exceptions.SelectException: java.lang.IndexOutOfBoundsException: Index: 0 | | | at com.alibaba.otter.node.etl.select.selector.MessageParser.parse(MessageParser.java:212) | | | at com.alibaba.otter.node.etl.select.selector.canal.CanalEmbedSelector.selector(CanalEmbedSelector.java:278) | | | at com.alibaba.otter.node.etl.select.SelectTask.processSelect(SelectTask.java:236) | | | at com.alibaba.otter.node.etl.select.SelectTask.access$300(SelectTask.java:94) | | | at com.alibaba.otter.node.etl.select.SelectTask$1.run(SelectTask.java:208) | | | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) | | | at java.util.concurrent.FutureTask.run(FutureTask.java:266) | | | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) | | | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) | | | at java.lang.Thread.run(Thread.java:745) | | | Caused by: java.lang.IndexOutOfBoundsException: Index: 0 | | | at java.util.Collections$EmptyList.get(Collections.java:4454) | | | at com.alibaba.otter.canal.protocol.CanalEntry$RowChange.getRowDatas(CanalEntry.java:8189) | | | at com.alibaba.otter.node.etl.select.selector.MessageParser.parse(MessageParser.java:110) | | | ... 9 more | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+ | STACK | thread_name="pipelineId = 41,taskName = ProcessSelect" thread_id=0xe903f;is_daemon=false;priority=5; | | | @com.alibaba.otter.node.etl.select.selector.MessageParser.parse(MessageParser.java:215) | | | at com.alibaba.otter.node.etl.select.selector.canal.CanalEmbedSelector.selector(CanalEmbedSelector.java:278) | | | at com.alibaba.otter.node.etl.select.SelectTask.processSelect(SelectTask.java:236) | | | at com.alibaba.otter.node.etl.select.SelectTask.access$300(SelectTask.java:94) | | | at com.alibaba.otter.node.etl.select.SelectTask$1.run(SelectTask.java:208) | | | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) | | | at java.util.concurrent.FutureTask.run(FutureTask.java:266) | | | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) | | | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) | | | at java.lang.Thread.run(Thread.java:745) | +-----------------+--------------------------------------------------------------------------------------------------------------------------------------------------------+

650.png

以上是在v4.2.17版本报错,v4.2.14版本可以正常跑

原提问者GitHub用户tuziluobu

展开
收起
古拉古拉 2023-06-16 19:57:10 27 0
1 条回答
写回答
取消 提交回答
  • 最新的主干加了判断约束,可以考虑升级4.2.18

    原回答者GitHub用户agapple

    2023-06-16 20:17:13
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
搭建电商项目架构连接MySQL 立即下载
搭建4层电商项目架构,实战连接MySQL 立即下载
PolarDB MySQL引擎重磅功能及产品能力盛大发布 立即下载

相关镜像