New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FailureHandler重写无法实现回滚失败处理 #5231
Comments
tc tm rm日志放上来 |
tm:
RM:
|
|
你说的单机模拟镜像不一致导致回滚失败处理问题的日志在哪?rm回滚的好好的,哪来的脏写?回滚没失败不就是PhaseTwo_Rollbacked吗? |
抱歉,发错了 RM:
|
那你把对应的15:43:32秒左右的tm,tc日志再发出来,把你的failurehandler的代码也发一下,你可以每个通知都打一行日志,看下到底进了是什么状态 |
我发个完整的
这个就是进入的状态RollbackDone,然后直接抛出异常信息,不会走failureHandler RM1:正常回滚
RM2:镜像不一致,回滚失败
TC:
|
FailureHandler代码: @Configuration
@Slf4j
public class SeataFailureHandlerConfig {
@Bean
public FailureHandler failureHandler(){
return new EmailSeataFailureHandler();
}
class EmailSeataFailureHandler extends DefaultFailureHandlerImpl {
@Override
public void onBeginFailure(GlobalTransaction tx, Throwable cause) {
super.onBeginFailure(tx, cause);
log.warn("邮件通知:分布式事物出现异常:[onBeginFailure],xid:[{}]", tx.getXid());
}
@Override
public void onCommitFailure(GlobalTransaction tx, Throwable cause) {
super.onCommitFailure(tx, cause);
log.warn("邮件通知:分布式事物出现异常:[onCommitFailure],xid:[{}]", tx.getXid());
}
@Override
public void onRollbackFailure(GlobalTransaction tx, Throwable originalException) {
super.onRollbackFailure(tx, originalException);
log.warn("邮件通知:分布式事物出现异常:[onRollbackFailure],xid:[{}]", tx.getXid());
}
...
} |
已经有 |
已确认问题存在,由于社区内部会议,讨论后认为脏数据不可能自动成功回滚,应该标记为failed人工介入处理,就改成failed了,而client侧忘记修改,只匹配了RollbackRetrying状态,所以走了done了 |
问题涉及版本1.5-1.6.1 |
嗯嗯,我试了1.4.2是用的RollbackRetrying可以使用failurehandler。叨扰了,感谢及时回复 |
没事没事,多亏你详细的描述和反馈,否则不会这么快排查出原因,社区也要靠广大用户及时反馈问题 |
修复认领 |
更正涉及版本为1.6.0-1.6.1 |
Ⅰ. Issue Description
单机模拟镜像不一致导致回滚失败处理问题。TM端捕获的异常是feign远程调用出的错(不过不就是分支事务处理失败所以触发回滚吗),导致捕获的异常状态始终是 RollbackDone就结束了,不会走自实现的FailureHandler。此外好奇的是分支事务的处理不是直接响应给TC吗?
Ⅱ. Describe what happened
If there is an exception, please attach the exception trace:
Ⅲ. Describe what you expected to happen
Ⅳ. How to reproduce it (as minimally and precisely as possible)
Ⅴ. Anything else we need to know?
Ⅵ. Environment:
The text was updated successfully, but these errors were encountered: