Deadlock found when trying to get lock; try restarting transaction主要要是死锁问题呢怎么解决
try restarting transaction","flowType": "-1","flowDesc": "kafka消息处理失败"}删除的时候,尽量不能使用索引进行删除,一个过千万的数据量,在根据索引删除数据的时候,会有很大的问题!主要是根据索引删除数据,会有一个间隙锁,在加锁间隙又插入这个表,那么会爆出这个死锁!生产启动的时候,定期排查的 一些日志,发现一个问题呢,主要是加锁了,很奇怪
目录
问题描述:
生产启动的时候,定期排查的 一些日志,发现一个问题呢,主要是加锁了,很奇怪,主要是业务数据的一般的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
更多推荐
所有评论(0)