Skip to content

Commit

Permalink
[Hotfix][Jdbc Sink] fix xa transaction commit failure on pipeline res…
Browse files Browse the repository at this point in the history
…tore (apache#3809)
  • Loading branch information
ic4y authored and lhyundeadsoul committed Jan 3, 2023
1 parent 13af784 commit 12fb764
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ public GroupXaOperationResult<XidInfo> commit(
List<XidInfo> xids, boolean allowOutOfOrderCommits, int maxCommitAttempts) {
GroupXaOperationResult<XidInfo> result = new GroupXaOperationResult<>();
int origSize = xids.size();
LOG.debug("commit {} transactions", origSize);
LOG.info("commit {} transactions", origSize);
for (Iterator<XidInfo> i = xids.iterator();
i.hasNext() && (result.hasNoFailures() || allowOutOfOrderCommits); ) {
XidInfo x = i.next();
i.remove();
try {
LOG.info("committing {} transaction", x.getXid());
xaFacade.commit(x.getXid(), false);
result.succeeded(x);
} catch (XaFacade.TransientXaException e) {
Expand All @@ -67,7 +68,12 @@ public GroupXaOperationResult<XidInfo> commit(
}
}
result.getForRetry().addAll(xids);
result.throwIfAnyFailed("commit");
//TODO At present, it is impossible to distinguish whether
// the repeated Commit failure caused by restore (exception should not be thrown) or
// the failure of normal process Commit (exception should be thrown).
// So currently the exception is not thrown.

// result.throwIfAnyFailed("commit");
throwIfAnyReachedMaxAttempts(result, maxCommitAttempts);
result.getTransientFailure()
.ifPresent(
Expand Down

0 comments on commit 12fb764

Please sign in to comment.