sajjad-moradi commented on code in PR #15173:
URL: https://github.com/apache/pinot/pull/15173#discussion_r1980471971


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/minion/generator/BaseTaskGenerator.java:
##########
@@ -117,6 +118,26 @@ public List<SegmentZKMetadata> 
getSegmentsZKMetadataForTable(String tableNameWit
     return selectedSegmentZKMetadataList;
   }
 
+  public List<SegmentZKMetadata> 
getNonConsumingSegmentsZKMetadataForRealtimeTable(String tableNameWithType) {
+    IdealState idealState = 
_clusterInfoAccessor.getIdealState(tableNameWithType);
+    Set<String> idealStateSegments = idealState.getPartitionSet();
+    List<SegmentZKMetadata> segmentZKMetadataList = 
_clusterInfoAccessor.getSegmentsZKMetadata(tableNameWithType);
+    List<SegmentZKMetadata> selectedSegmentZKMetadataList = new ArrayList<>();
+    for (SegmentZKMetadata segmentZKMetadata : segmentZKMetadataList) {
+      String segmentName = segmentZKMetadata.getSegmentName();
+      if (idealStateSegments.contains(segmentName)
+          && segmentZKMetadata.getStatus().isCompleted() // skip consuming 
segments
+          && 
!idealState.getInstanceStateMap(segmentName).containsValue(SegmentStateModel.CONSUMING))
 {

Review Comment:
   To find the list of online segments, we need to use 
`.containsValue(ONLINE)`, which makes it again 3 checks!



-- 
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-unsubscr...@pinot.apache.org

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