You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/05/07 06:02:13 UTC

[GitHub] [kafka] guozhangwang commented on a change in pull request #8629: MINOR: Update nodesWithPendingFetchRequests in Fetcher before sending request

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



##########
File path: clients/src/main/java/org/apache/kafka/clients/consumer/internals/Fetcher.java
##########
@@ -258,12 +258,12 @@ public synchronized int sendFetches() {
             if (log.isDebugEnabled()) {
                 log.debug("Sending {} {} to broker {}", isolationLevel, data.toString(), fetchTarget);
             }
-            RequestFuture<ClientResponse> future = client.send(fetchTarget, request);
-            // We add the node to the set of nodes with pending fetch requests before adding the
-            // listener because the future may have been fulfilled on another thread (e.g. during a
+            // We add the node to the set of nodes with pending fetch requests before sending the
+            // request to the client because the future may have been fulfilled on another thread (e.g. during a
             // disconnection being handled by the heartbeat thread) which will mean the listener
-            // will be invoked synchronously.
+            // will be invoked synchronously, and hence the added id would not be removed anymore.
             this.nodesWithPendingFetchRequests.add(entry.getKey().id());
+            RequestFuture<ClientResponse> future = client.send(fetchTarget, request);

Review comment:
       This is the actual fix, others are just log4j improvements I got during the debugging.




----------------------------------------------------------------
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:
users@infra.apache.org