当前使用版本(必填,否则不予处理)

3.5.5

该问题是如何引起的?(确定最新版也有问题再提!!!)

并发更新问题

重现步骤(如果有就写完整)

在并发批量更新时,出现相互等待,出现的索引。

事务1:update A SET xx =1 WHERE id =1, update A SET xx =1 WHERE id =2 事务2:update A SET xx =1 WHERE id =2, update A SET xx =1 WHERE id =1

以上这种情况,并发时就会出现死锁的问题。可以通过重写saveBatch,updateBath方法,在更新前对要更新的数据进行排序 但是如果这样的话,IKeyGenerator就没太大的作用了。 是否可以实现像hibernate提供参数配置【order_inserts、order_updates】

报错信息

```java com.wjh.wms.server.stock.internal.database.mapper.StockMapper.updateById (batch index #1) failed. Cause: java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transaction ; Deadlock found when trying to get lock; try restarting transaction; nested exception is java.sql.BatchUpdateException: Deadlock found when trying to get lock; try restarting transaction at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:271) at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:92) at com.baomidou.mybatisplus.extension.toolkit.SqlHelper.executeBatch(SqlHelper.java:202) at com.baomidou.mybatisplus.extension.service.impl.ServiceImpl.executeBatch(ServiceImpl.java:270) ````

Comment From: huayanYu

自己处理