Skip to content
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

bugfix: global session is always begin in saga mode for 2.x #5464

Merged
merged 6 commits into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changes/en-us/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ The version is updated as follows:
- [[#5372](https://github.com/seata/seata/pull/5372)] fix transaction timeout on client side not execute hook and failureHandler
- [[#4734](https://github.com/seata/seata/pull/4734)] check if table meta cache should be refreshed in AT mode
- [[#5426](https://github.com/seata/seata/pull/5426)] fix the GlobalTransactional annotation npe issue.
- [[#5464](https://github.com/seata/seata/pull/5464)] fix global session is always begin in saga mode

### optimize:
- [[#5208](https://github.com/seata/seata/pull/5208)] optimize throwable getCause once more
Expand Down Expand Up @@ -99,6 +100,7 @@ Thanks to these contributors for their code commits. Please report an unintended
- [l81893521](https://github.com/l81893521)
- [dmego](https://github.com/dmego)
- [zsp419](https://github.com/zsp419)
- [tuwenlin](https://github.com/tuwenlin)


Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
Expand Down
2 changes: 2 additions & 0 deletions changes/zh-cn/2.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [[#5351](https://github.com/seata/seata/pull/5351)] 优化 TCC 模式下的 RPC filter
- [[#5354](https://github.com/seata/seata/pull/5354)] 重构 RPC 集成模块
- [[#5370](https://github.com/seata/seata/pull/5370)] 优化事务失败处理 handler
- [[#5464](https://github.com/seata/seata/pull/5464)] 修复saga模式全局事务状态始终为Begin的问题

### security:
- [[#5172](https://github.com/seata/seata/pull/5172)] 修复一些安全漏洞的版本
Expand Down Expand Up @@ -101,6 +102,7 @@ Seata 是一款开源的分布式事务解决方案,提供高性能和简单
- [l81893521](https://github.com/l81893521)
- [dmego](https://github.com/dmego)
- [zsp419](https://github.com/zsp419)
- [tuwenlin](https://github.com/tuwenlin)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ public static void endCommitted(GlobalSession globalSession, boolean retryGlobal
MetricsPublisher.postSessionDoneEvent(globalSession, IdConstants.STATUS_VALUE_AFTER_COMMITTED_KEY, true,
beginTime, retryBranch);
} else {
if (globalSession.isSaga()) {
globalSession.setStatus(GlobalStatus.Committed);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

默认的defaultcore也会调这里,也是会进行一个setstatus,不如把这行提出来,把defaultcore里的setstatus删了,这个setstatus放到if判断的前面

globalSession.end();
}
MetricsPublisher.postSessionDoneEvent(globalSession, false, false);
}
}
Expand Down Expand Up @@ -201,6 +205,10 @@ public static void endRollbacked(GlobalSession globalSession, boolean retryGloba
MetricsPublisher.postSessionDoneEvent(globalSession, IdConstants.STATUS_VALUE_AFTER_ROLLBACKED_KEY, true,
beginTime, retryBranch);
} else {
if (globalSession.isSaga()) {
globalSession.setStatus(GlobalStatus.Rollbacked);
globalSession.end();
}
MetricsPublisher.postSessionDoneEvent(globalSession, GlobalStatus.Rollbacked, false, false);
}
}
Expand Down