snleee commented on a change in pull request #5782:
URL: https://github.com/apache/incubator-pinot/pull/5782#discussion_r465536355



##########
File path: 
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java
##########
@@ -2366,6 +2404,23 @@ public void endReplaceSegments(String tableNameWithType, 
String segmentLineageEn
         tableNameWithType, segmentLineageEntryId);
   }
 
+  private Set<String> getOnlineSegmentsFromExternalView(String 
tableNameWithType) {
+    ExternalView externalView = getTableExternalView(tableNameWithType);
+    if (externalView != null) {
+      Set<String> partitionSet = externalView.getPartitionSet();
+      Set<String> onlineSegments = new 
HashSet<>(HashUtil.getHashMapCapacity(partitionSet.size()));
+      for (String partition : partitionSet) {
+        Map<String, String> instanceStateMap = 
externalView.getStateMap(partition);
+        if (instanceStateMap.containsValue(SegmentStateModel.ONLINE) || 
instanceStateMap
+            .containsValue(SegmentStateModel.CONSUMING)) {
+          onlineSegments.add(partition);
+        }
+      }
+      return onlineSegments;

Review comment:
       @Jackie-Jiang `ExternalView` does not expose an API to directly fetch 
the underlying map field.




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

Reply via email to