rhauch commented on a change in pull request #10158:
URL: https://github.com/apache/kafka/pull/10158#discussion_r579280518



##########
File path: 
connect/runtime/src/main/java/org/apache/kafka/connect/util/KafkaBasedLog.java
##########
@@ -161,6 +164,7 @@ public void start() {
 
         // Create the topic admin client and initialize the topic ...
         admin = topicAdminSupplier.get();   // may be null
+        useAdminForListOffsets = admin != null;

Review comment:
       I don't think the wait time matters whether we call 
`topicAdminSupplier.get()` in the constructor or here, because the constructor 
and the `start()` method are called synchronously from the Connect & MM2 
startup process.
   
   However, I do think there is a lot of value in following the existing 
pattern of not actually gathering, creating or using resources until the 
`start()` method. And we still need all of the fields, including the 
`useAdminForListOffset` boolean field that is set in the start method but also 
may be changed later on in the `readEndOffsets(...)` method if the admin is 
talking to a broker that doesn't support the end offsets method (e.g., 0.10.x). 
In fact, the latter is the primary error condition this PR is trying to fix.
   
   So, I think it's better to keep the code as is. But please let me know if 
you still disagree.




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