Skip to content

Commit

Permalink
Addresses PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
noob-se7en committed Jan 30, 2025
1 parent 5ea7c3f commit 6907c8f
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1902,21 +1902,25 @@ private void waitUntilPrevBatchIsComplete(String tableNameWithType, Set<String>
int maxAttempts = (batchStatusCheckTimeoutMs + batchStatusCheckIntervalMs - 1) / batchStatusCheckIntervalMs;
RetryPolicy retryPolicy =
RetryPolicies.fixedDelayRetryPolicy(maxAttempts, batchStatusCheckIntervalMs);
int attemptCount = 0;
final Set<String>[] segmentsYetToBeCommitted = new Set[1];

try {
attemptCount = retryPolicy.attempt(() -> {
retryPolicy.attempt(() -> {
segmentsYetToBeCommitted[0] = getSegmentsYetToBeCommitted(tableNameWithType, segmentBatchToCommit);
return segmentsYetToBeCommitted[0].isEmpty();
});
} catch (AttemptsExceededException | RetriableOperationException e) {
int attemptCount;
if (e instanceof AttemptsExceededException) {
attemptCount = ((AttemptsExceededException) e).getAttempts();
} else {
attemptCount = ((RetriableOperationException) e).getAttempts();
}
String errorMsg = String.format(
"Exception occurred while waiting for the forceCommit of segments: %s, attempt count: %d, "
+ "segmentsYetToBeCommitted: %s",
segmentBatchToCommit, attemptCount, segmentsYetToBeCommitted[0]);
LOGGER.error(errorMsg, e);
throw new RuntimeException(e);
throw new RuntimeException(errorMsg, e);
}
}

Expand Down

0 comments on commit 6907c8f

Please sign in to comment.