-
Notifications
You must be signed in to change notification settings - Fork 8.9k
bugfix: fix the bug where Role.participant does not execute hooks but clears them. #6385
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
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 2.x #6385 +/- ##
============================================
- Coverage 51.01% 50.93% -0.08%
- Complexity 5261 5277 +16
============================================
Files 934 937 +3
Lines 33029 33145 +116
Branches 4002 4019 +17
============================================
+ Hits 16849 16884 +35
- Misses 14511 14590 +79
- Partials 1669 1671 +2
🚀 New features to boost your workflow:
|
...a-spring/src/main/java/org/apache/seata/saga/engine/store/db/DbAndReportTcStateLogStore.java
Outdated
Show resolved
Hide resolved
...a-spring/src/main/java/org/apache/seata/saga/engine/tm/DefaultSagaTransactionalTemplate.java
Outdated
Show resolved
Hide resolved
tm/src/main/java/org/apache/seata/tm/api/TransactionalTemplate.java
Outdated
Show resolved
Hide resolved
| GlobalTransaction globalTransaction; | ||
| try { | ||
| globalTransaction = getGlobalTransaction(machineInstance, context); | ||
| if (globalTransaction == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not unify it in template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to move the getGlobalTransaction method to the template? If so, it should be a refactoring of the code and should not be done in this commit.
你的意思是把getGlobalTransaction 方法移动到模版里么 如果这样的话应该是对代码的一次重构,不应该在本次提交中完成
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean to move the getGlobalTransaction method to the template? If so, it should be a refactoring of the code and should not be done in this commit. 你的意思是把getGlobalTransaction 方法移动到模版里么 如果这样的话应该是对代码的一次重构,不应该在本次提交中完成
我说的是在template中针对传入globaltransactional进行判空,如果是空的应该抛异常提示不允许为null
I'm talking about passing in globaltransactional in the template for null, if it's null it should throw an exception to indicate that it's not allowed to be null.
...a-spring/src/main/java/org/apache/seata/saga/engine/store/db/DbAndReportTcStateLogStore.java
Outdated
Show resolved
Hide resolved
ptyin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| private void cleanUp() { | ||
| TransactionHookManager.clear(); | ||
| private void cleanUp(GlobalTransaction tx) { | ||
| if (tx == null || tx.getGlobalTransactionRole() == GlobalTransactionRole.Launcher) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does DefaultSagaTransactionalTemplate.java do the processing, but no exception is thrown here?
为什么DefaultSagaTransactionalTemplate.java做了处理,而这里没有进行抛出异常?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private void cleanUp(GlobalTransaction tx) {
if (tx == null) {
throw new FrameworkException("Global transaction does not exist. Unable to proceed without a valid global transaction context.",
FrameworkErrorCode.ObjectNotExists);
}
if (tx.getGlobalTransactionRole() == GlobalTransactionRole.Launcher) {
TransactionHookManager.clear();
}
}
Is this suitable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have repaired it in this way, please review.
funky-eyes
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
… clears them.
Ⅰ. Describe what this PR did
bugfix: fix the bug where Role.participant does not execute hooks but clears them.
Ⅱ. Does this pull request fix one issue?
fixes #6384
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews