Copilot commented on code in PR #17575:
URL: https://github.com/apache/pinot/pull/17575#discussion_r2728418144


##########
pinot-tools/src/main/java/org/apache/pinot/tools/utils/PinotConfigUtils.java:
##########
@@ -152,14 +152,19 @@ public static Map<String, Object> 
readConfigFromFile(String configFileName)
   }
 
   public static Map<String, Object> generateBrokerConf(String clusterName, 
String zkAddress, String brokerHost,
-      int brokerPort, int brokerMultiStageRunnerPort)
+      int brokerPort, int brokerGrpcPort, int brokerMultiStageRunnerPort)
       throws SocketException, UnknownHostException {
     Map<String, Object> properties = new HashMap<>();
     properties.put(CommonConstants.Helix.CONFIG_OF_CLUSTER_NAME, clusterName);
     properties.put(CommonConstants.Helix.CONFIG_OF_ZOOKEEPER_SERVER, 
zkAddress);
     properties.put(CommonConstants.Broker.CONFIG_OF_BROKER_HOSTNAME,
         !StringUtils.isEmpty(brokerHost) ? brokerHost : 
NetUtils.getHostAddress());
     properties.put(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT, brokerPort 
!= 0 ? brokerPort : getAvailablePort());
+    if (brokerGrpcPort > 0) {
+      properties.put(CommonConstants.Broker.Grpc.KEY_OF_GRPC_PORT, 
brokerGrpcPort);
+    } else if (brokerGrpcPort == 0) {
+      properties.put(CommonConstants.Broker.Grpc.KEY_OF_GRPC_PORT, 
getAvailablePort());
+    }

Review Comment:
   The conditional logic handling three cases (positive, zero, negative) for 
`brokerGrpcPort` should be documented with a comment explaining the semantic 
meaning of each value range. This would clarify that: positive values 
explicitly set the gRPC port, 0 auto-assigns an available port, and negative 
values (or omission from the map) disable gRPC.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to