-
Notifications
You must be signed in to change notification settings - Fork 8.8k
bugfix: the issue where connection held during the first phase of PostgreSQL cannot be rollback #6825
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: the issue where connection held during the first phase of PostgreSQL cannot be rollback #6825
Conversation
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.
https://github.com/apache/incubator-seata/blob/2.x/changes/zh-cn/2.x.md
https://github.com/apache/incubator-seata/blob/2.x/changes/en-us/2.x.md
请在上述md文件中登记pr信息和作者信息
Please register pr information and author information in the above md file
rm-datasource/src/main/java/org/apache/seata/rm/datasource/xa/ConnectionProxyXA.java
Outdated
Show resolved
Hide resolved
@@ -140,8 +140,12 @@ public synchronized void xaCommit(String xid, long branchId, String applicationD | |||
* @param applicationData application data | |||
*/ | |||
public synchronized void xaRollback(String xid, long branchId, String applicationData) throws XAException { | |||
XAXid xaXid = XAXidBuilder.build(xid, branchId); | |||
xaRollback(xaXid); | |||
if (this.xaBranchXid != 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.
If the XA transaction is rollback due to timeout, the xaBranchXid here is not null. Should we verify that xid and branchId in the parameter are the same xaBranchXid?
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.
The ConnectionProxyXA object for rollback is obtained using the xid and branchId from the parameters. Therefore, when xaBranchXid != null, the xid and branchId of xaBranchXid are the same as those in the parameters. Additional validation is only necessary if the ConnectionProxyXA is not obtained using xid and branchId.
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.
If the XA transaction is rollback due to timeout, the xaBranchXid here is not null. Should we verify that xid and branchId in the parameter are the same xaBranchXid?
当前的connectionProxyXA是通过xid和branch生成的XAXid去map中进行获取,所以可以保证它们的xid和branch一定是相同的。
The current connectionProxyXA is obtained from the XAXid generated by xid and branch in the map, so it can be guaranteed that their xid and branch must be the same.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 2.x #6825 +/- ##
=========================================
Coverage 52.42% 52.42%
Complexity 6380 6380
=========================================
Files 1080 1080
Lines 37558 37560 +2
Branches 4452 4452
=========================================
+ Hits 19689 19692 +3
+ Misses 15919 15918 -1
Partials 1950 1950
|
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
Thank you for your contributions to Seata. If possible, please send your Dingtalk contact information to my email, and I will invite you to join the Seata developer group. |
…t-14168276155
Ⅰ. Describe what this PR did
Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews