开发者社区> 问答> 正文

es适配器mysql查询语句中没有转义_id会抛出异常

SELECT * FROM ( SELECT news.id, news.appId, news.createTime, news.modifyTime, news.creator, news.deleted, news.enable, news.title, news.type, news.showType, news.publishTime, news.source, news.original, news.canComment, news.reporter, news.dept, news.listImgs, news.advertImg, news.carouselImg, news.modifier, news.shortTitle, news.pushSwitch, news.tag, news.onlySpecialSubcolumn, news.specialSubcolumn, news.askReporterSwitch, news.askReporter, news.externalLink, news.linkUrl, news.specialLine, news.specialLineStatus, news.specialLineId, news.joinRoll, news.enableShare, news.extend, news.top, news.extension, news.deptId, news.titleColor, news.status, news.summary, content, columnId, channelId FROM news AS news LEFT OUTER JOIN news_content AS content ON content.newsId = news.id LEFT OUTER JOIN ( SELECT newsId, group_concat( news_column.id ORDER BY news_column.id DESC SEPARATOR ';' ) AS columnId FROM news_column AS news_column WHERE news_column.deleted = 0 GROUP BY news_column.newsId ) AS col ON news.id = col.newsId LEFT OUTER JOIN ( SELECT newsId, group_concat( news_channel.id ORDER BY news_channel.id DESC SEPARATOR ';' ) AS channelId FROM news_channel AS news_channel WHERE news_channel.deleted = 0 GROUP BY news_channel.newsId ) AS cha ON news.id = cha.newsId ) _v WHERE _v._id =? 堆栈信息如下: `2019-09-18 18:36:47.387 [pool-3-thread-1] ERROR c.a.o.canal.adapter.launcher.loader.CanalAdapterWorker - java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '_v._id' in 'where clause' java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '_v._id' in 'where clause' at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.sync(ESSyncService.java:112) at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.sync(ESSyncService.java:60) at com.alibaba.otter.canal.client.adapter.es.ESAdapter.sync(ESAdapter.java:175) at com.alibaba.otter.canal.client.adapter.es.ESAdapter.sync(ESAdapter.java:154) at com.alibaba.otter.canal.adapter.launcher.loader.AbstractCanalAdapterWorker.batchSync(AbstractCanalAdapterWorker.java:201) at com.alibaba.otter.canal.adapter.launcher.loader.AbstractCanalAdapterWorker.lambda$null$1(AbstractCanalAdapterWorker.java:62) at java.util.ArrayList.forEach(ArrayList.java:1257) at com.alibaba.otter.canal.adapter.launcher.loader.AbstractCanalAdapterWorker.lambda$null$2(AbstractCanalAdapterWorker.java:58) at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) at java.util.concurrent.FutureTask.run(FutureTask.java) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '_v._id' in 'where clause' at com.alibaba.otter.canal.client.adapter.support.Util.sqlRS(Util.java:65) at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.subTableSimpleFieldOperation(ESSyncService.java:624) at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.insert(ESSyncService.java:175) at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.sync(ESSyncService.java:95) ... 12 common frames omitted Caused by: java.lang.RuntimeException: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '_v._id' in 'where clause' at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.lambda$subTableSimpleFieldOperation$5(ESSyncService.java:682) at com.alibaba.otter.canal.client.adapter.support.Util.sqlRS(Util.java:60) ... 15 common frames omitted Caused by: java.lang.RuntimeException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '_v._id' in 'where clause' at com.alibaba.otter.canal.client.adapter.support.Util.sqlRS(Util.java:65) at com.alibaba.otter.canal.client.adapter.es.support.ESTemplate.updateByQuery(ESTemplate.java:145) at com.alibaba.otter.canal.client.adapter.es.service.ESSyncService.lambda$subTableSimpleFieldOperation$5(ESSyncService.java:679) ... 16 common frames omitted Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column '_v._id' in 'where clause' at sun.reflect.GeneratedConstructorAccessor46.newInstance(Unknown Source) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:425) at com.mysql.jdbc.Util.getInstance(Util.java:408) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:943) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3970) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3906) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2677) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2549) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1861) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1962) at com.alibaba.druid.pool.DruidPooledPreparedStatement.executeQuery(DruidPooledPreparedStatement.java:228) at com.alibaba.otter.canal.client.adapter.support.Util.sqlRS(Util.java:59) ... 18 common frames omitted 2019-09-18 18:36:47.389 [Thread-49] ERROR c.a.o.canal.adapter.launcher.loader.CanalAdapterWorker - Outer adapter sync failed! Error sync but ACK! 2019-09-18 18:36:47.895 [Thread-49] ERROR c.a.o.canal.adapter.launcher.loader.CanalAdapterWorker - process error! com.alibaba.otter.canal.protocol.exception.CanalClientException: deserializer failed at com.alibaba.otter.canal.client.CanalMessageDeserializer.deserializer(CanalMessageDeserializer.java:54) at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.receiveMessages(SimpleCanalConnector.java:331) at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.getWithoutAck(SimpleCanalConnector.java:323) at com.alibaba.otter.canal.client.impl.SimpleCanalConnector.getWithoutAck(SimpleCanalConnector.java:295) at com.alibaba.otter.canal.adapter.launcher.loader.CanalAdapterWorker.process(CanalAdapterWorker.java:106) at java.lang.Thread.run(Thread.java:748) Caused by: com.alibaba.otter.canal.protocol.exception.CanalClientException: something goes wrong with reason: something goes wrong with channel:[id: 0x7e535574, /10.244.0.0:49896 => /10.244.2.179:11111], exception=com.alibaba.otter.canal.server.exception.CanalServerException: ack error , clientId:1001 batchId:4784 is not exist , please check

at com.alibaba.otter.canal.client.CanalMessageDeserializer.deserializer(CanalMessageDeserializer.java:46) ... 5 common frames omitted`

相关配置yml: `dataSourceKey: defaultDS destination: 测试实例 groupId: g1 esMapping: _index: xinhuashe _type: news _id: id

原提问者GitHub用户Wandering

展开
收起
数据大拿 2023-05-04 10:37:57 111 0
1 条回答
写回答
取消 提交回答
  • 目前仅支持必须要 _id

    原回答者GitHub用户rewerma

    2023-05-04 18:15:15
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

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

相关镜像