ableegoldman commented on a change in pull request #8787:
URL: https://github.com/apache/kafka/pull/8787#discussion_r435593477



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/internals/StoreChangelogReader.java
##########
@@ -562,23 +564,18 @@ private void restoreChangelog(final ChangelogMetadata 
changelogMetadata) {
     }
 
     private Map<TopicPartition, Long> committedOffsetForChangelogs(final 
Set<TopicPartition> partitions) {
-        if (partitions.isEmpty())
-            return Collections.emptyMap();
-
         final Map<TopicPartition, Long> committedOffsets;
         try {
-            // those do not have a committed offset would default to 0
-            committedOffsets =  
mainConsumer.committed(partitions).entrySet().stream()
-                .collect(Collectors.toMap(Map.Entry::getKey, e -> e.getValue() 
== null ? 0L : e.getValue().offset()));
-        } catch (final TimeoutException e) {
-            // if it timed out we just retry next time.
-            return Collections.emptyMap();
-        } catch (final KafkaException e) {
-            throw new StreamsException(String.format("Failed to retrieve end 
offsets for %s", partitions), e);
+            committedOffsets = fetchCommittedOffsets(partitions, mainConsumer);
+        } catch (final StreamsException e) {
+            if (e.getCause() instanceof TimeoutException) {

Review comment:
       I thought this might raise some eyebrows. I wanted to keep the 
ClientUtils methods consistent, and thought wrapping everything as a 
StreamsException would be cleaner. But maybe it makes more sense to throw the 
TimeoutException separately...




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to