PrachiKhobragade commented on code in PR #15173: URL: https://github.com/apache/pinot/pull/15173#discussion_r1980343401
########## 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: Can this be done by going through the idealStates for each online segment and just fetch the zkmetadata from getSegmentsZKMetadata(tableNameWithType, segmentName)? In that case we would not need the 3rd check `idealState.getInstanceStateMap(segmentName).containsValue(SegmentStateModel.CONSUMING)` -- 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