You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2021/10/12 15:45:49 UTC

[GitHub] [pinot] yupeng9 commented on a change in pull request #7556: Let the controller getTableInstance() call to return the list of live brokers of a table.

yupeng9 commented on a change in pull request #7556:
URL: https://github.com/apache/pinot/pull/7556#discussion_r727268599



##########
File path: pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/ExternalViewReader.java
##########
@@ -87,7 +87,18 @@ protected ByteArrayInputStream getInputStream(byte[] brokerResourceNodeData) {
     return new ByteArrayInputStream(brokerResourceNodeData);
   }
 
+  // Return a map from tablename (without type) to live brokers (of format host:port).
   public Map<String, List<String>> getTableToBrokersMap() {
+    return getTableToBrokersMapFromExternalView(false, true);
+

Review comment:
       nil: newline

##########
File path: pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -2862,6 +2864,13 @@ public TableStats getTableStats(String tableNameWithType) {
     return new TableStats(creationTime);
   }
 
+  // Return the list of live brokers serving a table. Each entry is of the following format:
+  // Broker_hostname_port (e.g., broker_12.34.56.78_1234)
+  public List<String> getLiveBrokersForTable(String tableNameWithType) {
+    ExternalViewReader externalViewReader = new ExternalViewReader(new ZkClient(_helixZkURL));
+    Map<String, List<String>> tableToBrokersMap = externalViewReader.getTableWithTypeToRawBrokerInstanceIdsMap();
+    return tableToBrokersMap == null ? null : tableToBrokersMap.get(tableNameWithType);

Review comment:
       shall we return empty map other than null?




-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org