Jackie-Jiang commented on a change in pull request #6150: URL: https://github.com/apache/incubator-pinot/pull/6150#discussion_r506685742
########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotInstanceRestletResource.java ########## @@ -101,6 +101,7 @@ public String getInstance( response.put("port", instanceConfig.getPort()); response.set("tags", JsonUtils.objectToJsonNode(instanceConfig.getTags())); response.set("pools", JsonUtils.objectToJsonNode(instanceConfig.getRecord().getMapField(InstanceUtils.POOL_KEY))); + response.put("grpcPort", instanceConfig.getRecord().getSimpleField(InstanceUtils.GRPC_PORT_KEY)); Review comment: Not related to this PR, but we might want to provide a new API to return the `Instance` to be in-sync with the setter API. ########## File path: pinot-controller/src/test/java/org/apache/pinot/controller/api/PinotInstanceRestletResourceTest.java ########## @@ -144,14 +148,18 @@ public void testInstanceListingAndCreation() String serverInstanceUpdateTagsUrl = _controllerRequestURLBuilder.forInstanceUpdateTags(serverInstanceId, Lists.newArrayList("tag_REALTIME", "newTag_OFFLINE", "newTag_REALTIME")); sendPutRequest(serverInstanceUpdateTagsUrl); - checkInstanceInfo(brokerInstanceId, "Broker_1.2.3.4", 1234, new String[]{"tag_BROKER", "newTag_BROKER"}, null, - null); + checkInstanceInfo(brokerInstanceId, "Broker_1.2.3.4", 1234, new String[]{"tag_BROKER", "newTag_BROKER"}, null, null); checkInstanceInfo(serverInstanceId, "Server_1.2.3.4", 2345, - new String[]{"tag_REALTIME", "newTag_OFFLINE", "newTag_REALTIME"}, null, null); + new String[]{"tag_REALTIME", "newTag_OFFLINE", "newTag_REALTIME"}, null, null, 28090); } private void checkInstanceInfo(String instanceName, String hostName, int port, String[] tags, String[] pools, int[] poolValues) { + checkInstanceInfo(instanceName, hostName, port, tags, pools, poolValues, NOT_SET_GRPC_PORT_VALUE); Review comment: Remove the static import ```suggestion checkInstanceInfo(instanceName, hostName, port, tags, pools, poolValues, Instance.NOT_SET_GRPC_PORT_VALUE); ``` ########## File path: pinot-spi/src/main/java/org/apache/pinot/spi/config/instance/Instance.java ########## @@ -38,29 +38,40 @@ * "tags": ["example_OFFLINE"], * "pools": { * "example_OFFLINE": 0 - * } + * }, + * "grpcPort": 8090 * } * </pre> */ public class Instance extends BaseJsonConfig { + public static int NOT_SET_GRPC_PORT_VALUE = -1; + private final String _host; private final int _port; private final InstanceType _type; private final List<String> _tags; private final Map<String, Integer> _pools; + private final int _grpcPort; + + + public Instance(String host, int port, InstanceType type, List<String> tags, Map<String, Integer> pools) { + this(host, port, type, tags, pools, NOT_SET_GRPC_PORT_VALUE); + } @JsonCreator public Instance(@JsonProperty(value = "host", required = true) String host, @JsonProperty(value = "port", required = true) int port, @JsonProperty(value = "type", required = true) InstanceType type, - @JsonProperty("tags") @Nullable List<String> tags, @JsonProperty("pools") @Nullable Map<String, Integer> pools) { + @JsonProperty("tags") @Nullable List<String> tags, @JsonProperty("pools") @Nullable Map<String, Integer> pools, + @JsonProperty("grpcPort") int grpcPort) { Preconditions.checkArgument(host != null, "'host' must be configured"); Preconditions.checkArgument(type != null, "'type' must be configured"); _host = host; _port = port; _type = type; _tags = tags; _pools = pools; + _grpcPort = grpcPort; Review comment: This will be set to 0 from the json if `grpcPort` is not set. You can check for 0 and put -1 ########## File path: pinot-spi/src/main/java/org/apache/pinot/spi/config/instance/Instance.java ########## @@ -38,29 +38,40 @@ * "tags": ["example_OFFLINE"], * "pools": { * "example_OFFLINE": 0 - * } + * }, + * "grpcPort": 8090 * } * </pre> */ public class Instance extends BaseJsonConfig { + public static int NOT_SET_GRPC_PORT_VALUE = -1; + private final String _host; private final int _port; private final InstanceType _type; private final List<String> _tags; private final Map<String, Integer> _pools; + private final int _grpcPort; + + + public Instance(String host, int port, InstanceType type, List<String> tags, Map<String, Integer> pools) { Review comment: Recommend removing this constructor. This class is always deserialized from json ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org