因为主键冲突和唯一索引冲突导致挂起不能同步,不知如何解决
唯一索引冲突:
org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [insert into ysod.product_gd_detail(gd_id , ws_id , comp_number , pass_number , nopass_number , effect_pass , operator_id , work_hour , comp_date , owner_id , finish , station_id , real_pass_number , real_comp_number , id) values (? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ?) on duplicate key update gd_id=values(gd_id) , ws_id=values(ws_id) , comp_number=values(comp_number) , pass_number=values(pass_number) , nopass_number=values(nopass_number) , effect_pass=values(effect_pass) , operator_id=values(operator_id) , work_hour=values(work_hour) , comp_date=values(comp_date) , owner_id=values(owner_id) , finish=values(finish) , station_id=values(station_id) , real_pass_number=values(real_pass_number) , real_comp_number=values(real_comp_number) , id=values(id)]; Duplicate entry '3466728-1198-49287' for key 'gd_id_2'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '3466728-1198-49287' for key 'gd_id_2'
主键冲突:
pid:15 nid:6 exception:setl:com.alibaba.otter.node.etl.load.exception.LoadException: java.util.concurrent.ExecutionException: com.alibaba.otter.node.etl.load.exception.LoadException: com.alibaba.otter.node.etl.load.exception.LoadException: com.alibaba.otter.node.etl.load.exception.LoadException: org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [update ysod.product_gd_detail set gd_id = ? , ws_id = ? , comp_number = ? , pass_number = ? , nopass_number = ? , effect_pass = ? , operator_id = ? , work_hour = ? , comp_date = ? , owner_id = ? , finish = ? , station_id = ? , real_pass_number = ? , real_comp_number = ? , id = ? where ( id = ? )]; Duplicate entry '29830031' for key 'PRIMARY'; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '29830031' for key 'PRIMARY'
原提问者GitHub用户 zhuhuawu
如果涉及唯一键的变更,建议是先删除后插入的模式,否则针对多个唯一键的记录进行交换的时候会出错
原回答者GitHub用户agapple
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。