1,飞书机器人推送报错异常
org.springframework.dao.DeadlockLoserDataAccessException:
### Error updating database. Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
### The error may exist in com/idanchuang/market/coupon/server/infrastructure/persistence/mapper/CouponGoodsMapper.java (best guess)
### The error may involve com.idanchuang.market.coupon.server.infrastructure.persistence.mapper.CouponGoodsMapper.update-Inline
### The error occurred while setting parameters
### SQL: UPDATE xxxx SET is_delete=?,update_time=? WHERE is_delete=0 AND (coupon_id = ? AND sku_id IN (?))
### Cause: com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
; Deadlock found when trying to get lock; try restarting transaction; nested exception is com.mysql.cj.jdbc.exceptions.MySQLTransactionRollbackException: Deadlock found when trying to get lock; try restarting transaction
at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:266)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72)
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:88)
2,排查思路
- 使用mysql命令查看最近死锁日志