Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
Zouxxyy committed Dec 4, 2024
1 parent 300cc67 commit 6a4caeb
Showing 1 changed file with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -716,21 +716,10 @@ private int tryCommit(
ConflictCheck conflictCheck,
String branchName,
@Nullable String statsFileName) {
int cnt = 0;
int retryCount = 0;
RetryResult retryResult = null;
while (true) {
Snapshot latestSnapshot = snapshotManager.latestSnapshot();
cnt++;
if (cnt >= commitMaxRetries) {
if (retryResult != null) {
retryResult.cleanAll();
}
throw new RuntimeException(
String.format(
"Commit failed after %s attempts, there maybe exist commit conflicts between multiple jobs.",
commitMaxRetries));
}

CommitResult result =
tryCommitOnce(
retryResult,
Expand All @@ -750,9 +739,20 @@ private int tryCommit(
break;
}

if (retryCount >= commitMaxRetries) {
if (retryResult != null) {
retryResult.cleanAll();
}
throw new RuntimeException(
String.format(
"Commit failed after %s retries, there maybe exist commit conflicts between multiple jobs.",
commitMaxRetries));
}

retryResult = (RetryResult) result;
retryCount++;
}
return cnt;
return retryCount + 1;
}

private int tryOverwrite(
Expand Down Expand Up @@ -1069,22 +1069,22 @@ CommitResult tryCommitOnce(
}

public void compactManifest() {
int cnt = 0;
int retryCount = 0;
ManifestCompactResult retryResult = null;
while (true) {
cnt++;
retryResult = compactManifest(retryResult);
if (retryResult.isSuccess()) {
break;
}

if (cnt >= commitMaxRetries) {
if (retryCount >= commitMaxRetries) {
retryResult.cleanAll();
throw new RuntimeException(
String.format(
"Commit compact manifest failed after %s attempts, there maybe exist commit conflicts between multiple jobs.",
"Commit compact manifest failed after %s retries, there maybe exist commit conflicts between multiple jobs.",
commitMaxRetries));
}
retryCount++;
}
}

Expand Down

0 comments on commit 6a4caeb

Please sign in to comment.