事务参与方发生异常,发起方不回滚
- Dominant language
- Java
- Stars
- 4.2k
- Forks
- 1.4k
- PR merge metrics
- No merged PRs in 30d
Description
- [x] I have searched the [issues](https://github.com/codingapi/tx-lcn/issues) of this repository and believe that this is not a duplicate.
### 1. Bug Description
两个服务在tm中均正常注册(每个单独的服务会在tm中有两个注册),在发起方异常时参与方会回滚,但是当参与方发生异常,发起方的事务不回滚
### 2. Environment:
- JDK version: 1.8
- OS: wimdows10
- TX-LCN version: 5.0.2
- Others:
### 3. Exception Stacktrace
事务发起方代码
@LcnTransaction(propagation = DTXPropagation.REQUIRED)
@Transactional(rollbackFor = Exception.class)
@Override
public int add(Demo demo) {
try {
//本服务保存
int i = demoSerivce.insertDemo(demo);
//远程服务保存
int add = feignServiceB.add(demo.getName());
return i;
} catch (Exception e) {
System.out.println("出现问题,抛出异常" + e);
throw new RuntimeException(e);
}
}
事务参与方
@LcnTransaction(propagation = DTXPropagation.REQUIRED)
@Transactional(rollbackFor = Exception.class)
@Override
public int add(Demo demo) {
try {
//本地保存
int i = demoSerivce.insertDemo(demo);
int ex = 10 / 0;
return i;
} catch (Exception e) {
System.out.println("出现问题,抛出异常" + e);
throw new RuntimeException(e);
}
}
发生异常的参与方日志
java.lang.ArithmeticException: / by zero
2019-04-26 12:22:57.805 ERROR 8232 --- [nio-9001-exec-1] c.c.txlcn.tc.core.DTXServiceExecutor : business code error @group(1b0b6c96e11537)
TM日志
2019-04-26 12:24:37.224 DEBUG 1788 --- [ntLoopGroup-5-1] c.c.t.txmsg.netty.handler.RpcCmdDecoder : cmd->{"key":"1b0b859a211536","msg":{"action":"createGroup","groupId":"1b0b859a211537","state":100},"remoteKey":"localhost/127.0.0.1:8070"}
2019-04-26 12:24:37.225 DEBUG 1788 --- [-rpc-service-12] com.codingapi.txlcn.txmsg.LCNCmdType : parsed txmsg cmd: createGroup
2019-04-26 12:24:37.357 DEBUG 1788 --- [-rpc-service-12] c.c.t.t.t.t.CreateGroupExecuteService : created group @group(1b0b859a211537)
2019-04-26 12:24:37.357 DEBUG 1788 --- [ntLoopGroup-5-1] c.c.t.txmsg.netty.handler.RpcCmdEncoder : send->{"key":"1b0b859a211536","msg":{"action":"createGroup","groupId":"1b0b859a211537","state":200},"remoteKey":"/127.0.0.1:8908"}
2019-04-26 12:24:37.753 DEBUG 1788 --- [ntLoopGroup-5-2] c.c.t.txmsg.netty.handler.RpcCmdDecoder : cmd->{"key":"1b0b85bb511537","msg":{"action":"notifyGroup","data":{"groupId":"1b0b859a211537","state":1},"groupId":"1b0b859a211537","state":100},"remoteKey":"/127.0.0.1:8070"}
2019-04-26 12:24:37.754 DEBUG 1788 --- [-rpc-service-13] com.codingapi.txlcn.txmsg.LCNCmdType : parsed txmsg cmd: notifyGroup
2019-04-26 12:24:37.801 DEBUG 1788 --- [-rpc-service-13] c.c.t.t.t.t.NotifyGroupExecuteService : notify group state: 1 @group(1b0b859a211537)
2019-04-26 12:24:37.822 DEBUG 1788 --- [-rpc-service-13] c.c.t.tm.core.SimpleTransactionManager : group[1b0b859a211537]'s transaction units: []
2019-04-26 12:24:37.822 DEBUG 1788 --- [-rpc-service-13] c.c.t.t.core.storage.redis.RedisStorage : remove group:1b0b859a211537 from redis.
2019-04-26 12:24:37.839 DEBUG 1788 --- [-rpc-service-13] c.c.t.t.t.t.NotifyGroupExecuteService : notify group successfully. @group(1b0b859a211537)
2019-04-26 12:24:37.839 DEBUG 1788 --- [ntLoopGroup-5-2] c.c.t.txmsg.netty.handler.RpcCmdEncoder : send->{"key":"1b0b85bb511537","msg":{"action":"notifyGroup","data":1,"groupId":"1b0b859a211537","state":200},"remoteKey":"/127.0.0.1:8938"}
### 4. Tour Idea
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.