• Deadlock found when trying to get lock; try restarting transaction主要要是死锁问题呢怎么解决


    目录

    问题描述:

    问题发生原因:

    问题日志详情:


    问题描述:

    生产启动的时候,定期排查的 一些日志,发现一个问题呢,主要是加锁了,很奇怪,主要是业务数据的一般的CURD。至于其他的很奇怪!主要查看业务代码。

    问题发生原因:

    删除的时候,尽量不能使用索引进行删除,一个过千万的数据量,在根据索引删除数据的时候,会有很大的问题!主要是根据索引删除数据,会有一个间隙锁,在加锁间隙又插入这个表,那么会爆出这个死锁!

     

    问题日志详情:

    ### Error flushing statements.  Cause: org.apache.ibatis.executor.BatchExecutorException: xxx..money.mastercontrol.dao.mapper.biz.BizNewsEventMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transaction
    ### Cause: org.apache.ibatis.executor.BatchExecutorException: xxx..money.mastercontrol.dao.mapper.biz.BizNewsEventMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transaction","flowType": "-1","flowDesc": "kafka消息处理失败"}
    2022-07-19 00:42:09.521 [audit_platform_to_bus-0-C-1] ERROR c.g.h.m.p.consumer.AbstractConsumer - 
    ### Error flushing statements.  Cause: org.apache.ibatis.executor.BatchExecutorException: xxx..money.mastercontrol.dao.mapper.biz.BizNewsEventMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transaction
    ### Cause: org.apache.ibatis.executor.BatchExecutorException: xxx..money.mastercontrol.dao.mapper.biz.BizNewsEventMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transaction
    org.apache.ibatis.exceptions.PersistenceException: 
    ### Error flushing statements.  Cause: org.apache.ibatis.executor.BatchExecutorException: xxx..money.mastercontrol.dao.mapper.biz.BizNewsEventMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transaction
    ### Cause: org.apache.ibatis.executor.BatchExecutorException: xxx..money.mastercontrol.dao.mapper.biz.BizNewsEventMapper.insert (batch index #1) failed. Cause: java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transaction
     

  • 相关阅读:
    什么是数据压缩?解释数据压缩的原理和不同的压缩算法
    torchvision.models中模型编辑的requires_grad
    在印度与软件相关的发明可不可以申请专利?
    FOC学习笔记-坐标变换以及仿真验证
    linux下mysql的三种安装方法
    uni-app实现web-view图片长按下载
    【GPGPU编程模型与架构原理】第一章 1.1 GPGPU 与并行计算机
    198. 打家劫舍
    软考系统架构师知识点集锦六:项目管理
    Redis实战篇
  • 原文地址:https://blog.csdn.net/m0_59252007/article/details/126015404