-
Notifications
You must be signed in to change notification settings - Fork 8.8k
PG数据库XA模式,GlobalTransactional默认一分钟超时后,事务发起者服务回滚失败 #6814
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
Comments
针对pg数据库,seata一阶段并不会持有该connection,二阶段下发的时候是一个新的connection,本身就不存在currentXid,你那边确定currentXid不为空吗? |
事务超时会通知回滚,分布式事务发起者服务没有预提交,io.seata.rm.datasource.xa.AbstractDataSourceProxyXA.getConnectionForXAFinish(XAXid)方法如下代码会拿到待提交事务的connectionProxyXA,里面有currentXid。 |
你这个是超时的情况,恰好本地一阶段还没结束,所以持有了连接,我指的是二阶段没有持有连接时下发的情况。 |
是的,超时情况下,持有了连接,org.postgresql.xa.PGXAConnection.rollback(Xid)方法当前的currentXid不为null,且和入参的xid不是同一个对象,导致没有回滚。这种情况是否可以重写io.seata.rm.datasource.xa.XABranchXid的equals方法,只对比xid和branchId属性解决? |
我认为如果是持有的connection,实际上在rollback的时候其内部成员变量的xaBranchXid是不为空的,实际上可以加一个判断,在rollback的时候,如果xaBranchXid不为空默认用成员变量这个,而不是用生成的新的xaBranchXid去触发rollback,你可以提交一个pr来修复该问题吗? |
可以的,目前我们的1.5.2版本,io.seata.rm.datasource.xa.ConnectionProxyXA.xaRollback(String, long, String)方法重写成这样是否可以? |
我认为这行代码不需要,只需要直接如下即可 |
pr已提交,#6825 |
Ⅰ. Issue Description
org.postgresql.xa.PGXAConnection.rollback(Xid)方法
if (currentXid != null && currentXid.equals(xid))判断中的equals方法,io.seata.rm.datasource.xa.XABranchXid未重写equals方法,导致判断返回false,事务发起者连接未回滚事务,而是直接提交事务。
Ⅱ. Describe what happened
If there is an exception, please attach the exception trace:
Ⅲ. Describe what you expected to happen
Ⅳ. How to reproduce it (as minimally and precisely as possible)
Minimal yet complete reproducer code (or URL to code):
Ⅴ. Anything else we need to know?
Ⅵ. Environment:
java -version
):uname -a
):The text was updated successfully, but these errors were encountered: