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


##########
clients/src/main/java/org/apache/kafka/clients/NetworkClient.java:
##########
@@ -1140,8 +1140,11 @@ private void handleInitiateApiVersionRequests(long now) {
                     int nodeId = Integer.parseInt(node);
                     // In order to allow separate connections to coordinators, 
the client uses large positive node ID values
                     // (Integer.MAX_VALUE - nodeId) for these connections 
which do not match the target broker's actual node ID.
-                    // To avoid those, only check if the node ID is less than 
half of Integer.MAX_VALUE.
-                    if (clusterId != null && nodeId >= 0 && nodeId < 
Integer.MAX_VALUE / 2) {
+                    // We can get the real node ID by subtracting from 
Integer.MAX_VALUE.
+                    if (nodeId > Integer.MAX_VALUE / 2) {

Review Comment:
   OK, but in that case, wouldn't the entire principle of using large node IDs 
for the coordinator connections be entirely broken then? We could end up a 
broker using a very high node ID, and another one which coincidentally has the 
same node ID when it is being connected as a coordinator. @dajac What do you 
think? What's a safe path here?



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