dajac commented on a change in pull request #11864:
URL: https://github.com/apache/kafka/pull/11864#discussion_r821354458



##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java
##########
@@ -1003,6 +1003,9 @@ void invokeCompletedOffsetCommitCallbacks() {
         RequestFuture<Void> future =  null;
         if (!coordinatorUnknown()) {
             future = doCommitOffsetsAsync(offsets, callback);
+        } else if (offsets.isEmpty()) {
+            // No need to lookup coordinator if offsets is empty since commit 
of empty offsets is completed locally.
+            future = doCommitOffsetsAsync(offsets, callback);

Review comment:
       Would it make sense to do this check even before checking if the 
coordinator is known? Moreover, it seems that we could skip calling 
`doCommitOffsetsAsync` entirely by returning a completed future directly. What 
do you think?
   
   ```
   if (offsets.isEmpty())
      return RequestFuture.voidSuccess();
   ```

##########
File path: 
clients/src/main/java/org/apache/kafka/clients/consumer/internals/ConsumerCoordinator.java
##########
@@ -1003,6 +1003,9 @@ void invokeCompletedOffsetCommitCallbacks() {
         RequestFuture<Void> future =  null;

Review comment:
       Not related to you change but there is an extra space before `null`. Do 
you mind fixing this in your PR?




-- 
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: jira-unsubscr...@kafka.apache.org

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


Reply via email to