AnatolyPopov commented on code in PR #16434:
URL: https://github.com/apache/iceberg/pull/16434#discussion_r3586283414
##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/channel/Coordinator.java:
##########
@@ -150,22 +152,50 @@ protected boolean receive(Envelope envelope) {
private void commit(boolean partialCommit) {
try {
doCommit(partialCommit);
+ if (!partialCommit) {
+ consecutiveCommitFailures = 0;
+ }
} catch (RuntimeException e) {
if (partialCommit) {
LOG.warn(
"Partial commit {} failed for task {}, will retry",
commitState.currentCommitId(),
taskId,
e);
- } else {
- LOG.error("Commit {} failed for task {}",
commitState.currentCommitId(), taskId, e);
+ return;
+ }
+
+ if (!isCommitFailedException(e)) {
+ // CommitStateUnknownException, ValidationException,
ForbiddenException,
+ // NPE, anything else -- not retryable, terminate immediately
throw e;
}
+
+ consecutiveCommitFailures++;
+ if (consecutiveCommitFailures >= config.commitMaxConsecutiveFailures()) {
+ LOG.error(
+ "Commit {} failed for task {} ({} consecutive failures,
terminating)",
+ commitState.currentCommitId(),
+ taskId,
+ consecutiveCommitFailures,
+ e);
+ throw e;
+ }
+ LOG.warn(
+ "Commit {} failed for task {} ({} consecutive failures, will retry)",
+ commitState.currentCommitId(),
+ taskId,
+ consecutiveCommitFailures,
+ e);
} finally {
commitState.endCurrentCommit();
}
}
+ private static boolean isCommitFailedException(Throwable throwable) {
Review Comment:
Does this method still make sense? I think it would be a little bit easier
to understand when the retry is happening if this one will be in-lined.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]