-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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: modify XA mode pre commit transaction from commit phase to before close phase #7102
bugfix: modify XA mode pre commit transaction from commit phase to before close phase #7102
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.x #7102 +/- ##
============================================
- Coverage 52.24% 52.20% -0.04%
+ Complexity 6814 6812 -2
============================================
Files 1154 1154
Lines 41057 41058 +1
Branches 4811 4813 +2
============================================
- Hits 21451 21436 -15
- Misses 17569 17586 +17
+ Partials 2037 2036 -1
|
I suggest making the title more specific to better describe the bug that has been fixed. |
Description added |
rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java
Outdated
Show resolved
Hide resolved
rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java
Outdated
Show resolved
Hide resolved
…gyeyu0/incubator-seata into bugfix-xa-close-prepare
@@ -117,6 +117,10 @@ private void xaEnd(XAXid xaXid, int flags) throws XAException { | |||
if (!xaEnded) { | |||
xaResource.end(xaXid, flags); | |||
xaEnded = true; | |||
} else { | |||
if (flags == XAResource.TMSUCCESS) { |
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.
为什么只有TMSUCCESS才需要end?join进来的不再end了吗?
假设事务1 commit,事务2继续用这个connection commit(等于先join)走到这个xaend,就不执行xaend了?还有rollback的时候会走到这个xaend方法,此时rollback不直接end,直接进行rollback吗?
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.
xaEnded为false的时候会xaResource.end,这里flags == XAResource.TMSUCCESS是为了事务2继续用这个connection commit时能够xaResource.end,因为第一次commit把xaEnded置为true了
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.
@xiaoxiangyeyu0 我看到只在close的时候至为false
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.
xaEnded默认是false,第一次调用xaEnd方法会把xaEnded置为true
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.
connection没有close时直接复用,xaended就是true了,如何再次end? @xiaoxiangyeyu0
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.
传入的flags值为XAResource.TMSUCCESS,走else的分支会执行end
# Conflicts: # rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.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.
LGTM
pr已登记 |
Ⅰ. Describe what this PR did
Modify XA mode pre commit transaction from commit phase to before close phase
Ⅱ. Does this pull request fix one issue?
fixes #7100
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
link #7100
Ⅴ. Special notes for reviews