apache / apache/incubator-seata
集成sharding-JDBC和mybatis-plus后事务不回滚
- Dominant language
- Java
- Stars
- 26k
- Forks
- 8.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 4
Description
maven版本: sharding-JDBC 4.1.1 , mybatis-plus 3.3.2 ,seata 1.2.0 ,postgresql 42.2.12
描述:按照seata-samples中集成sharding-JDBC的demo,测试过程中,A服务使用Fegin调用B服务, A服务接口新增,B服务接口新增,手动抛异常,事务可以正常回滚, 但是如果B服务接口做一次查询操作,再新增,手动抛异常,则只有A服务会回滚,B服务没有回滚,插入了一条数据.
日志:
调用方A服务,日志显示回滚

被调用方B服务日志

seata-server日志
2020-07-21 17:59:16.648 INFO [batchLoggerPrint_1]io.seata.core.rpc.DefaultServerMessageListenerImpl.run:214 -SeataMergeMessage timeout=600000,transactionName=contextLoads()
,clientIp:192.168.0.104,vgroup:tckj_tx_group
2020-07-21 17:59:16.649 INFO [ServerHandlerThread_1_500]io.seata.server.coordinator.DefaultCoordinator.doGlobalBegin:159 -Begin new global transaction applicationId: tckj-api-user,transactionServiceGroup: tckj_tx_group, transactionName: contextLoads(),timeout:600000,xid:192.168.0.11:8091:2017515110
2020-07-21 17:59:16.658 INFO [batchLoggerPrint_1]io.seata.core.rpc.DefaultServerMessageListenerImpl.run:214 -SeataMergeMessage xid=192.168.0.11:8091:2017515110,branchType=AT,resourceId=jdbc:postgresql://192.168.0.11:5432/user,lockKey=front_user_00:1285393881545916418
,clientIp:192.168.0.104,vgroup:tckj_tx_group
2020-07-21 17:59:16.663 INFO [ServerHandlerThread_1_500]io.seata.server.coordinator.AbstractCore.lambda$branchRegister$0:87 -Register branch successfully, xid = 192.168.0.11:8091:2017515110, branchId = 2017515112, resourceId = jdbc:postgresql://192.168.0.11:5432/user ,lockKeys = front_user_00:1285393881545916418
2020-07-21 17:59:16.797 INFO [batchLoggerPrint_1]io.seata.core.rpc.DefaultServerMessageListenerImpl.run:214 -SeataMergeMessage xid=192.168.0.11:8091:2017515110,extraData=null
,clientIp:192.168.0.104,vgroup:tckj_tx_group
2020-07-21 17:59:16.808 INFO [ServerHandlerThread_1_500]io.seata.server.coordinator.DefaultCore.doGlobalRollback:290 -Rollback branch transaction successfully, xid = 192.168.0.11:8091:2017515110 branchId = 2017515112
2020-07-21 17:59:16.811 INFO [ServerHandlerThread_1_500]io.seata.server.coordinator.DefaultCore.doGlobalRollback:334 -Rollback global transaction successfully, xid = 192.168.0.11:8091:2017515110.
Contributor guide
Research direction
Start with the seata-samples sharding-JDBC integration demo using the listed Sharding-JDBC, MyBatis-Plus, Seata, and PostgreSQL versions. Reproduce the A-to-B Feign call where B queries before inserting, then verify why the B-side insert remains after the manual exception while A rolls back; done when both services roll back consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, postgresql
- Domain
- databases, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100