apache / apache/incubator-seata

@ControllerAdvice造成数据不回滚,出现数据不一致的情况

Open
#2,594 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

先按照springcloud-eureka-feign-mybatis-seata demo将工程运行起来。
在account服务中模拟抛出超时异常或者除0异常
order,account,storage中的数据都会回滚。

但是在account服务中添加如下代码
`@ControllerAdvice
public class BaseExceptionHandler {

@ExceptionHandler(value = Exception.class)
@ResponseBody
public Result error(Exception e) {
e.printStackTrace();
return new Result(20001, e.getMessage());
}
}
在account抛出除0异常后, order,storage中的数据不会回滚,order,storage均提示Branch commit result: PhaseTwo_Committed`
这个是什么原因,求解释,很急

Contributor guide

Open the contributing guide

Research direction

Start by running the springcloud-eureka-feign-mybatis-seata demo and reproduce the account-service failure with and without the shown BaseExceptionHandler. Compare the resulting data in account, order, and storage, along with the Branch commit result logs. Done means the cause of the differing rollback behavior is identified and documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.