guozhangwang commented on a change in pull request #8876:
URL: https://github.com/apache/kafka/pull/8876#discussion_r441831007



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/processor/internals/StoreChangelogReader.java
##########
@@ -564,8 +574,16 @@ private void restoreChangelog(final ChangelogMetadata 
changelogMetadata) {
             return Collections.emptyMap();
 
         try {
-            return restoreConsumer.endOffsets(partitions);
-        } catch (final TimeoutException e) {
+            if (adminClient != null) {
+                final ListOffsetsResult result = 
adminClient.listOffsets(partitions.stream().collect(
+                        Collectors.toMap(Function.identity(), tp -> 
OffsetSpec.latest())));
+                return result.all().get().entrySet().stream().collect(
+                        Collectors.toMap(Map.Entry::getKey, entry -> 
entry.getValue().offset()));
+            } else {
+                // we only fall back to use restore consumer if admin client 
is not set in TTD

Review comment:
       TTD would still call this function though... after some thinking I've 
decided to add a mock-admin to streams:test-utils (the existing mock is in 
clients:test and hence cannot be relied on).




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