• 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
     

  • 相关阅读:
    【iOS】OC关键字总结及底层原理(上)
    Vue3——teleport 传送门
    如何安装Wnmp并结合内网穿透实现外网访问内网Wnmp服务
    python 服务器数据转发数据 跳板机?
    C++数据结构题:DS 顺序表--连续操作
    Word文档字间距怎么调?
    独有且优质,这些Mac软件绝了
    物理不可克隆函数(Physical Unclonable Function,PUF)
    Flutter文章汇总
    SpringBoot项目与Nacos配置
  • 原文地址:https://blog.csdn.net/m0_59252007/article/details/126015404