apache / apache/incubator-seata
使用mybatisplus 先删除在批量插入没有执行成功
- Dominant language
- Java
- Stars
- 26k
- Forks
- 8.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 4
Description
- [x] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.
### Ⅰ. Issue Description
在全局事务中先删除一条数据,然后插入一条数据,两条数据的id保持一致,此时如果使用mybatisplus单条插入则没有问题,使用mybatisplus批量插入没有执行成功。
### Ⅱ. Describe what happened
debug发现有如下异常,批量插入时只有第一次注册失败日志,并且插入操作没有执行成功
```
### Error flushing statements. Cause: java.sql.SQLException: io.seata.core.exception.RmTransactionException: branch register exception, xid:192.168.1.12:8091:27612063588174772
### Cause: java.sql.SQLException: io.seata.core.exception.RmTransactionException: branch register exception, xid:192.168.1.12:8091:27612063588174772
; uncategorized SQLException; SQL state [null]; error code [0]; io.seata.core.exception.RmTransactionException: branch register exception, xid:192.168.1.12:8091:27612063588174772
```
### Ⅲ. Describe what you expected to happen
可以正常插入
### Ⅳ. How to reproduce it (as minimally and precisely as possible)
这个链接有详细的说明:https://developer.aliyun.com/ask/659744
Minimal yet complete reproducer code (or URL to code):
参考这个:https://developer.aliyun.com/ask/659744
### Ⅴ. Anything else we need to know?
无
### Ⅵ. Environment:
- JDK version(e.g. `java -version`): graalvm-ce-17
- Seata client/server version: 1.8
- Database version: mysql 8
- OS(e.g. `uname -a`): Darwin Kernel Version 24.1.0
- Others:
Contributor guide
Research direction
Start with the linked Alibaba Cloud reproducer and reproduce the Seata 1.8 case using MyBatis-Plus, MySQL 8, and GraalVM JDK 17. Compare single-row insertion with batch insertion after deleting and reinserting the same id, then trace the branch register exception shown during statement flushing. Done means the batch insert completes successfully in the described global transaction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, mysql
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100