kirktrue commented on code in PR #14359:
URL: https://github.com/apache/kafka/pull/14359#discussion_r1325171010


##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/NetworkClientDelegate.java:
##########
@@ -63,6 +68,31 @@ public NetworkClientDelegate(
         this.unsentRequests = new ArrayDeque<>();
         this.requestTimeoutMs = 
config.getInt(ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG);
         this.retryBackoffMs = 
config.getLong(ConsumerConfig.RETRY_BACKOFF_MS_CONFIG);
+        this.tryConnectNodes = new HashSet<>();
+    }
+
+    @Override
+    public boolean isUnavailable(Node node) {
+        return NetworkClientUtils.isUnavailable(client, node, time);
+    }
+
+    @Override
+    public void maybeThrowAuthFailure(Node node) {
+        NetworkClientUtils.maybeThrowAuthFailure(client, node);
+    }
+
+    @Override
+    public void tryConnect(Node node) {

Review Comment:
   Yes—`tryConnect` and `maybeTryConnect` were intended to be used together. 
The reason the latter wasn't in the interface was because of the difference in 
_when_ we perform network I/O. In the existing `Consumer`, we perform it 
immediately, whereas in the refactored `Consumer`, we delay that I/O until the 
last step. So the intent was to for the new `Consumer` to queue up the 
connection attempts and perform them in one step in `maybeTryConnect` vs. 
immediately when `tryConnect` was called.
   
   That said, a) it's confusing, and b) it's not needed in this particular PR, 
so I've removed the whole `NodeStatusDetector` for now.



##########
clients/src/main/java/org/apache/kafka/clients/consumer/internals/NetworkClientDelegate.java:
##########
@@ -63,6 +68,31 @@ public NetworkClientDelegate(
         this.unsentRequests = new ArrayDeque<>();
         this.requestTimeoutMs = 
config.getInt(ConsumerConfig.REQUEST_TIMEOUT_MS_CONFIG);
         this.retryBackoffMs = 
config.getLong(ConsumerConfig.RETRY_BACKOFF_MS_CONFIG);
+        this.tryConnectNodes = new HashSet<>();
+    }
+
+    @Override
+    public boolean isUnavailable(Node node) {
+        return NetworkClientUtils.isUnavailable(client, node, time);
+    }
+
+    @Override
+    public void maybeThrowAuthFailure(Node node) {
+        NetworkClientUtils.maybeThrowAuthFailure(client, node);
+    }
+
+    @Override
+    public void tryConnect(Node node) {

Review Comment:
   Yes—`tryConnect` and `maybeTryConnect` were intended to be used together. 
The reason the latter wasn't in the interface was because of the difference in 
_when_ we perform network I/O. In the existing `Consumer`, we perform it 
immediately, whereas in the refactored `Consumer`, we delay that I/O until the 
last step. So the intent was to for the new `Consumer` to queue up the 
connection attempts and perform them in one step in `maybeTryConnect` vs. 
immediately when `tryConnect` was called.
   
   That said, a) it's confusing, and b) it's not needed in this particular PR, 
so I've removed the whole `NodeStatusDetector` for now.



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