Skip to content

Commit

Permalink
bugfix: fix when doing global rollback ,may cause an endless loop
Browse files Browse the repository at this point in the history
  • Loading branch information
sixlei committed May 22, 2024
1 parent 682b830 commit 4f078f2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
2 changes: 2 additions & 0 deletions changes/en-us/2.x.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Add changes here for all PR submitted to the 2.x branch.
- [[#6554](https://github.com/apache/incubator-seata/pull/6554)] fix unfixed serializer
- [[#6555](https://github.com/apache/incubator-seata/pull/6555)] businessActionContext is compatible with io seata
- [[#6553](https://github.com/apache/incubator-seata/pull/6553)] fix saga "cannot matching status"
- [[#6569](https://github.com/apache/incubator-seata/pull/6569)] fix when doing global rollback ,may cause an endless loop


### optimize:
Expand Down Expand Up @@ -208,5 +209,6 @@ Thanks to these contributors for their code commits. Please report an unintended
- [TakeActionNow2019](https://github.com/TakeActionNow2019)
- [sunxunle](https://github.com/sunxunle)
- [bageyang](https://github.com/bageyang)
- [sixl](https://github.com/sixlei)

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 @@ -42,6 +42,7 @@
- [[#6554](https://github.com/apache/incubator-seata/pull/6554)] 修复序列化器不固定使用对应配置序列化器的问题
- [[#6555](https://github.com/apache/incubator-seata/pull/6555)] 修复businessActionContext对io seata包的不兼容
- [[#6553](https://github.com/apache/incubator-seata/pull/6553)] 修复执行完 'ServiceTask' 后无法应用任何评估器的问题
- [[#6569](https://github.com/apache/incubator-seata/pull/6569)] 修复做全局回滚时,可能造成死循环的问题

### optimize:
- [[#6031](https://github.com/apache/incubator-seata/pull/6031)] 添加undo_log表的存在性校验
Expand Down Expand Up @@ -204,5 +205,6 @@
- [TakeActionNow2019](https://github.com/TakeActionNow2019)
- [sunxunle](https://github.com/sunxunle)
- [bageyang](https://github.com/bageyang)
- [sixl](https://github.com/sixlei)

同时,我们收到了社区反馈的很多有价值的issue和建议,非常感谢大家。
Original file line number Diff line number Diff line change
Expand Up @@ -339,20 +339,22 @@ public void undo(DataSourceProxy dataSourceProxy, String xid, long branchId) thr
State.GlobalFinished.name());
}
} else {
insertUndoLogWithGlobalFinished(xid, branchId, UndoLogParserFactory.getInstance(), conn);
conn.commit();
if (LOGGER.isInfoEnabled()) {
LOGGER.info("xid {} branch {}, undo_log added with {}", xid, branchId,
State.GlobalFinished.name());
try {
insertUndoLogWithGlobalFinished(xid, branchId, UndoLogParserFactory.getInstance(), conn);
conn.commit();
if (LOGGER.isInfoEnabled()) {
LOGGER.info("xid {} branch {}, undo_log added with {}", xid, branchId,
State.GlobalFinished.name());
}
} catch (SQLIntegrityConstraintViolationException e) {
// Possible undo_log has been inserted into the database by other processes, retrying rollback undo_log
if (LOGGER.isInfoEnabled()) {
LOGGER.info("xid {} branch {}, undo_log inserted, retry rollback", xid, branchId);
}
continue;
}
}

return;
} catch (SQLIntegrityConstraintViolationException e) {
// Possible undo_log has been inserted into the database by other processes, retrying rollback undo_log
if (LOGGER.isInfoEnabled()) {
LOGGER.info("xid {} branch {}, undo_log inserted, retry rollback", xid, branchId);
}
} catch (Throwable e) {
if (conn != null) {
try {
Expand Down

0 comments on commit 4f078f2

Please sign in to comment.