Skip to content

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

Merged
merged 6 commits into from
Sep 9, 2024

Conversation

xiaoxiangyeyu0
Copy link
Contributor

@xiaoxiangyeyu0 xiaoxiangyeyu0 commented Sep 7, 2024

…t-14168276155

  • I have registered the PR changes.

Ⅰ. 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

@funky-eyes funky-eyes added this to the 2.2.0 milestone Sep 8, 2024
@funky-eyes funky-eyes added type: bug Category issues or prs related to bug. mode: XA XA transaction mode module/rm-datasource rm-datasource module labels Sep 8, 2024
@funky-eyes funky-eyes changed the title Fix bug in https://github.com/apache/incubator-seata/issues/6814#even… bugfix: the issue where connection held during the first phase of PostgreSQL cannot be rollback Sep 8, 2024
Copy link
Contributor

@funky-eyes funky-eyes left a 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

@funky-eyes funky-eyes added the first-time contributor first-time contributor label Sep 8, 2024
@@ -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) {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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.

Copy link

codecov bot commented Sep 8, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 52.42%. Comparing base (e57fa54) to head (7fe906f).
Report is 2 commits behind head on 2.x.

Files with missing lines Patch % Lines
...ache/seata/rm/datasource/xa/ConnectionProxyXA.java 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            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           
Files with missing lines Coverage Δ
...ache/seata/rm/datasource/xa/ConnectionProxyXA.java 55.02% <50.00%> (-0.66%) ⬇️

... and 4 files with indirect coverage changes

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

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

LGTM

@funky-eyes funky-eyes merged commit 8844ce9 into apache:2.x Sep 9, 2024
7 checks passed
@funky-eyes
Copy link
Contributor

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.
[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
first-time contributor first-time contributor mode: XA XA transaction mode module/rm-datasource rm-datasource module type: bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants