KKcorps commented on a change in pull request #6119: URL: https://github.com/apache/incubator-pinot/pull/6119#discussion_r502295997
########## File path: pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java ########## @@ -422,10 +423,15 @@ public IdealState apply(@Nullable IdealState idealState) { * reuse instance configs in order to reduce ZK accesses */ public static List<String> getInstancesWithTag(List<InstanceConfig> instanceConfigs, String tag) { - List<String> instancesWithTag = new ArrayList<>(); + List<InstanceConfig> instancesWithTag = getInstancesConfigsWithTag(instanceConfigs, tag); + return instancesWithTag.stream().map(InstanceConfig::getInstanceName).collect(Collectors.toList()); Review comment: These APIs won't be called frequently. The only use of this API is to determine brokers for a tenant or table while creating a connection for a query. Once the connection is created, the API is only called again if the connection breaks. ########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ControllerBrokerResponse.java ########## @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pinot.controller.api.resources; + +public class ControllerBrokerResponse { + private String _instanceName; Review comment: done ########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/ControllerBrokerResponse.java ########## @@ -0,0 +1,55 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.pinot.controller.api.resources; + +public class ControllerBrokerResponse { Review comment: done ########## File path: pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/Constants.java ########## @@ -36,6 +36,7 @@ public static final String SCHEMA_TAG = "Schema"; public static final String TENANT_TAG = "Tenant"; public static final String BROKER_TAG = "Broker"; + public static final String BROKER_V2_TAG = "BrokerV2"; Review comment: removed ########## File path: pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java ########## @@ -474,6 +480,12 @@ public IdealState apply(@Nullable IdealState idealState) { * TODO: refactor code to use this method if applicable to reuse instance configs in order to reduce ZK accesses */ public static Set<String> getBrokerInstancesForTenant(List<InstanceConfig> instanceConfigs, String tenant) { - return new HashSet<>(HelixHelper.getInstancesWithTag(instanceConfigs, TagNameUtils.getBrokerTagForTenant(tenant))); + return getBrokerInstanceConfigsForTenant(instanceConfigs, tenant).stream().map(InstanceConfig::getInstanceName).collect( + Collectors.toSet()); Review comment: done ########## File path: pinot-common/src/main/java/org/apache/pinot/common/utils/helix/HelixHelper.java ########## @@ -474,6 +480,12 @@ public IdealState apply(@Nullable IdealState idealState) { * TODO: refactor code to use this method if applicable to reuse instance configs in order to reduce ZK accesses */ public static Set<String> getBrokerInstancesForTenant(List<InstanceConfig> instanceConfigs, String tenant) { - return new HashSet<>(HelixHelper.getInstancesWithTag(instanceConfigs, TagNameUtils.getBrokerTagForTenant(tenant))); + return getBrokerInstanceConfigsForTenant(instanceConfigs, tenant).stream().map(InstanceConfig::getInstanceName).collect( + Collectors.toSet()); } + + public static Set<InstanceConfig> getBrokerInstanceConfigsForTenant(List<InstanceConfig> instanceConfigs, String tenant) { + return new HashSet<>(HelixHelper.getInstancesConfigsWithTag(instanceConfigs, TagNameUtils.getBrokerTagForTenant(tenant))); Review comment: done ---------------------------------------------------------------- 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