Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -822,19 +822,25 @@ public void onSuccess(OffsetForEpochResult offsetsResult) {
FetchPosition requestPosition = fetchPositions.get(respTopicPartition);

if (respEndOffset.hasUndefinedEpochOrOffset()) {
handleOffsetOutOfRange(requestPosition, respTopicPartition,
"Failed leader offset epoch validation for " + respEndOffset
+ " since no end offset larger than current fetch epoch was reported");
try {
handleOffsetOutOfRange(requestPosition, respTopicPartition,
"Failed leader offset epoch validation for " + requestPosition
+ " since no end offset larger than current fetch epoch was reported");
} catch (OffsetOutOfRangeException e) {
// Swallow the OffsetOutOfRangeException to finish all partitions validation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't feel great about having this in the code, even if it's supposed to be temporary. I think we should just fix the exception propagation bug in this patch. It seems like it would be straightforward to do something similar to what is done in the onFailure path.

                    if (!(e instanceof RetriableException) && !cachedOffsetForLeaderException.compareAndSet(null, e)) {
                        log.error("Discarding error in OffsetsForLeaderEpoch because another error is pending", e);
                    }

Above may not be ideal, but at least it provides a way to propagate individual errors.

}
} else {
Optional<OffsetAndMetadata> divergentOffsetOpt = subscriptions.maybeCompleteValidation(
respTopicPartition, requestPosition, respEndOffset);
divergentOffsetOpt.ifPresent(
divergentOffset -> truncationWithoutResetPolicy.put(respTopicPartition, divergentOffset));
divergentOffset -> {
log.info("Detected log truncation with diverging offset: {}", divergentOffset);
Comment thread
abbccdda marked this conversation as resolved.
Outdated
truncationWithoutResetPolicy.put(respTopicPartition, divergentOffset);
});
}
});

if (!truncationWithoutResetPolicy.isEmpty()) {
Comment thread
abbccdda marked this conversation as resolved.
log.error("Detected log truncation with diverging offsets " + truncationWithoutResetPolicy);
throw new LogTruncationException(truncationWithoutResetPolicy);
}
}
Expand Down Expand Up @@ -1328,7 +1334,7 @@ private void handleOffsetOutOfRange(FetchPosition fetchPosition,
", for fetch offset: %d, " +
"root cause: %s",
offsetOutOfRangePartitions, fetchPosition.offset, reason);
log.error(errorMessage);
log.info(errorMessage);
throw new OffsetOutOfRangeException(errorMessage, offsetOutOfRangePartitions);
}
}
Expand Down