AndrewJSchofield commented on code in PR #22187:
URL: https://github.com/apache/kafka/pull/22187#discussion_r3197641870


##########
clients/src/main/java/org/apache/kafka/clients/NetworkClient.java:
##########
@@ -1107,6 +1124,19 @@ private void handleInitiateApiVersionRequests(long now) {
                 // not before ready.
                 this.connectionStates.checkingApiVersions(node);
                 ApiVersionsRequest.Builder apiVersionRequestBuilder = 
entry.getValue();
+                // If we know the cluster ID and node ID we are connecting to, 
we can include
+                // those details in the ApiVersions request for checking in 
the broker,
+                // provided that the metadata recovery strategy is not NONE. 
(KIP-1242)
+                if (metadataRecoveryStrategy != MetadataRecoveryStrategy.NONE 
&& metadataClusterCheckEnable) {
+                    String clusterId = this.metadataUpdater.clusterId();
+                    int nodeId = Integer.parseInt(node);
+                    // When connecting to coordinators, the client uses large 
positive node ID
+                    // values which do not match the target broker's node ID. 
Exclude those.
+                    if (clusterId != null && nodeId > 0 && nodeId < 
Integer.MAX_VALUE / 2) {

Review Comment:
   I've improved the explanation which I hope does the trick.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to