-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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: fix when doing global rollback ,may cause an endless loop #6569
base: 2.x
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 你只是使SQLIntegrityConstraintViolationException的范围缩小了,但是并没将因为唯一索引导致的SQLIntegrityConstraintViolationException 转换成SQLUndoDirtyException或者说抛出BranchRollbackFailed_Unretriable状态的BranchTransactionException,目前的改动我认为是无效的 You have merely narrowed the scope of SQLIntegrityConstraintViolationException without converting SQLIntegrityConstraintViolationException caused by unique indexes into SQLUndoDirtyException or throwing BranchTransactionException with BranchRollbackFailed_Unretriable state. I find the current changes ineffective. |
||
// 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 { | ||
|
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.
Why is it modified here?
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 changes here are to narrow the scope of the catch for SQLIntegrityConstraintViolationException at the outermost level, only handling conflicts with the unique index on the undo_log. If the unique index conflict also occurs when executing the rollback undoExecutor.executeOn for the business, it will enter a deadlock directly here.
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.
I am very sorry, I replied to this paragraph one day after you replied, but it has been pending. I didn't know I had to click submitted. disturb you
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.
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.
Sorry, I just saw your message now. I'll review the code as soon as possible.