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
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
3 changes: 2 additions & 1 deletion changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6812](https://github.com/apache/incubator-seata/pull/6812)] bugfix: change group and node offline status are not pushed in real time
- [[#6817](https://github.com/apache/incubator-seata/pull/6817)] bugfix: fix namingserver changVgroup failed
- [[#6820](https://github.com/apache/incubator-seata/pull/6820)] Fix file path error in the Dockerfile

- [[#6825](https://github.com/apache/incubator-seata/pull/6825)] Fix the issue of XA mode transaction timeout and inability to roll back in Postgres


### optimize:
Expand Down Expand Up @@ -133,5 +133,6 @@ Thanks to these contributors for their code commits. Please report an unintended
- [l81893521](https://github.com/l81893521)
- [laywin](https://github.com/laywin)
- [xingfudeshi](https://github.com/xingfudeshi)
- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)

Also, we receive many valuable issues, questions and advices from our community. Thanks for you all.
2 changes: 2 additions & 0 deletions changes/zh-cn/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
- [[#6759](https://github.com/apache/incubator-seata/pull/6759)] 修复跨库表主动刷新`tableMeta`的异常问题
- [[#6817](https://github.com/apache/incubator-seata/pull/6817)] 修复namingserver切换事务分组失效的问题
- [[#6820](https://github.com/apache/incubator-seata/pull/6820)] 修复Dockerfile得文件结构错误
- [[#6825](https://github.com/apache/incubator-seata/pull/6825)] 修复Postgres的XA模式事务超时无法回滚问题
-
### optimize:
- [[#6499](https://github.com/apache/incubator-seata/pull/6499)] 拆分 committing 和 rollbacking 状态的任务线程池
Expand Down Expand Up @@ -132,6 +133,7 @@
- [l81893521](https://github.com/l81893521)
- [laywin](https://github.com/laywin)
- [xingfudeshi](https://github.com/xingfudeshi)
- [xiaoxiangyeyu0](https://github.com/xiaoxiangyeyu0)

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

Original file line number Diff line number Diff line change
Expand Up @@ -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.

xaRollback(xaBranchXid);
} else {
XAXid xaXid = XAXidBuilder.build(xid, branchId);
xaRollback(xaXid);
}
}

/**
Expand Down
Loading