开发者社区> 问答> 正文

使用canal adapter同步数据到ES报错document missing

问题描述:

使用canal adapter从mysql同步订单数据到es,一笔订单有3次操作(1次Insert、2次Update),连续同步3条数据到es,3次操作都提示(Affected indexes: order_stppayinf_2020-07)。但最终没同步到ES中,查看日志有条ERROR的记录,但没有异常堆栈信息。而且已经提交位移了。

重点说明:

并不是所有订单都会失败,是偶发性问题(100笔订单有1笔失败)。单表操作,没有关联。

详细日志:

2020-07-02 15:31:22.384 [pool-6-thread-1] DEBUG c.a.otter.canal.client.adapter.es.service.ESSyncService - DML: {"data":[{"payment_inst":"ALIPAYCN","user_pay_ccy":null,"order_time":1593675082000,"discount_amt":null,"buyer_id":null,"marke_amt":"200","exchange_amt":"195"," stlbatno":null,"channel_pid":"3088201983678917","goods_tag":null,"buyer_login_id":null,"id":36353485,"order_type":"0","seller_id":null,"merchant_no":"888537298743010","exchange_rate":"0.97572","discount_flag":"0","user_pay_rate":null,"sub_pid":null,"result_msg":null,"ch ecksts":"0","accsts":"0","user_pay_amt":null,"trade_no":null,"result_code":null,"payer_time":null,"ordstatus":"00","channel_cost_rate":"1","order_no":"Tg12543089-520c-43e5-adca-fdc3f9cff43f$0001","trade_cost_amt":"0","exchange_ccy":"HKD","seller_email":null,"after_marke _amt":"200","org_payord_no":null,"remark":null,"sub_appid":null,"pay_way":"200101","account_balance_after":"0","update_time":null,"business_type":"0","stl_time":null,"marke_ccy":"MOP","clearsts":"0","discount_type":null,"account_balance_before":"0","payord_no":"D2020070 21531220000001","stlsts":"0","marke_rate":"1","paytype":null}],"database":"merchant_receipt","destination":"db1-merchant-receipt-mpop-basic-stppayinf","es":1593675082000,"groupId":"db1stppayinf","isDdl":false,"old":null,"pkNames":["id"],"sql":"","table":"mpop_basic_stpp ayinf","ts":1593675082328,"type":"INSERT"} Affected indexes: order_stppayinf_2020-07

2020-07-02 15:31:22.385 [pool-6-thread-1] DEBUG c.a.otter.canal.client.adapter.es.service.ESSyncService - DML: {"data":[{"payment_inst":"ALIPAYCN","user_pay_ccy":null,"order_time":1593675082000,"discount_amt":null,"buyer_id":null,"marke_amt":"200","exchange_amt":"195"," stlbatno":null,"channel_pid":"3088201983678917","goods_tag":null,"buyer_login_id":null,"id":36353485,"order_type":"0","seller_id":null,"merchant_no":"888537298743010","exchange_rate":"0.97572","discount_flag":"0","user_pay_rate":null,"sub_pid":null,"result_msg":null,"ch ecksts":"0","accsts":"0","user_pay_amt":null,"trade_no":null,"result_code":null,"payer_time":null,"ordstatus":"02","channel_cost_rate":"1","order_no":"Tg12543089-520c-43e5-adca-fdc3f9cff43f$0001","trade_cost_amt":"0","exchange_ccy":"HKD","seller_email":null,"after_marke _amt":"200","org_payord_no":null,"remark":null,"sub_appid":null,"pay_way":"200101","account_balance_after":"0","update_time":1593675082000,"business_type":"0","stl_time":null,"marke_ccy":"MOP","clearsts":"0","discount_type":null,"account_balance_before":"0","payord_no": "D202007021531220000001","stlsts":"0","marke_rate":"1","paytype":null}],"database":"merchant_receipt","destination":"db1-merchant-receipt-mpop-basic-stppayinf","es":1593675082000,"groupId":"db1stppayinf","isDdl":false,"old":[{"update_time":null,"ordstatus":"00"}],"pkNam es":["id"],"sql":"","table":"mpop_basic_stppayinf","ts":1593675082329,"type":"UPDATE"} Affected indexes: order_stppayinf_2020-07

2020-07-02 15:31:22.386 [pool-6-thread-1] DEBUG c.a.otter.canal.client.adapter.es.service.ESSyncService - DML: {"data":[{"payment_inst":"ALIPAYCN","user_pay_ccy":"CNY","order_time":1593675082000,"discount_amt":"0","buyer_id":"2088061321001","marke_amt":"200","exchange_a mt":"196","stlbatno":null,"channel_pid":"3088201983678917","goods_tag":null,"buyer_login_id":"13277989230","id":36353485,"order_type":"0","seller_id":null,"merchant_no":"888537298743010","exchange_rate":"0.98058","discount_flag":"0","user_pay_rate":"1.02061856","sub_pid ":null,"result_msg":"成功","checksts":"0","accsts":"0","user_pay_amt":"192","trade_no":"2018061321001004950200357551","result_code":"0000","payer_time":1593675082000,"ordstatus":"01","channel_cost_rate":"1","order_no":"Tg12543089-520c-43e5-adca-fdc3f9cff43f$0001","trade _cost_amt":"0","exchange_ccy":"HKD","seller_email":null,"after_marke_amt":"200","org_payord_no":null,"remark":null,"sub_appid":null,"pay_way":"200101","account_balance_after":"0","update_time":1593675082000,"business_type":"0","stl_time":null,"marke_ccy":"MOP","clearsts ":"0","discount_type":null,"account_balance_before":"0","payord_no":"D202007021531220000001","stlsts":"0","marke_rate":"1","paytype":null}],"database":"merchant_receipt","destination":"db1-merchant-receipt-mpop-basic-stppayinf","es":1593675082000,"groupId":"db1stppayinf ","isDdl":false,"old":[{"exchange_rate":"0.97572","user_pay_rate":null,"user_pay_ccy":null,"discount_amt":null,"buyer_id":null,"exchange_amt":"195","result_msg":null,"buyer_login_id":null,"user_pay_amt":null,"trade_no":null,"result_code":null,"payer_time":null,"ordstatu s":"02"}],"pkNames":["id"],"sql":"","table":"mpop_basic_stppayinf","ts":1593675082329,"type":"UPDATE"} Affected indexes: order_stppayinf_2020-07

2020-07-02 15:31:22.392 [pool-6-thread-1] ERROR c.a.otter.canal.client.adapter.es.support.ESTemplate - [order_stppayinf_2020-07/0VcNq41ZRH-KCa62cE8ecg][[order_stppayinf_2020-07][1]] DocumentMissingException[[order][D202007021531220000001]: document missing] 2020-07-02 15:31:22.392 [pool-6-thread-1] ERROR c.a.otter.canal.client.adapter.es.support.ESTemplate - [order_stppayinf_2020-07/0VcNq41ZRH-KCa62cE8ecg][[order_stppayinf_2020-07][1]] DocumentMissingException[[order][D202007021531220000001]: document missing]

期望:

该情况为什么没有捕获到异常? 而且当做正常处理成功了。 怀疑是否并发操作es,操作顺序乱码,还没有插入成功就进行更新了呢? 还请指导一下该如何解决此问题, 谢谢。

原提问者GitHub用户caoweixiong

展开
收起
Java工程师 2023-05-03 09:46:59 249 0
1 条回答
写回答
取消 提交回答
  • 通过查看源码,已找到问题原因,是我canal-adapter没配置好导致的,现已解决。

    原回答者GitHub用户caoweixiong

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

相关电子书

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