jtao15 commented on code in PR #10754: URL: https://github.com/apache/pinot/pull/10754#discussion_r1198135710
########## pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/PinotHelixResourceManager.java: ########## @@ -872,6 +874,24 @@ public List<SegmentZKMetadata> getSegmentsZKMetadata(String tableNameWithType) { return ZKMetadataProvider.getSegmentsZKMetadata(_propertyStore, tableNameWithType); } + public List<String> getLastLLCCompletedSegments(String tableNameWithType) { + Map<Integer, String> partitionIdToLastLLCCompletedSegmentMap = new HashMap<>(); + for (SegmentZKMetadata segMetadata : getSegmentsZKMetadata(tableNameWithType)) { + if (SegmentName.isLowLevelConsumerSegmentName(segMetadata.getSegmentName()) + && segMetadata.getStatus() == CommonConstants.Segment.Realtime.Status.DONE) { + LLCSegmentName llcName = LLCSegmentName.of(segMetadata.getSegmentName()); + int partitionGroupId = llcName.getPartitionGroupId(); + int sequenceNumber = llcName.getSequenceNumber(); + String lastCompletedSegName = partitionIdToLastLLCCompletedSegmentMap.get(partitionGroupId); + if (lastCompletedSegName == null + || LLCSegmentName.of(lastCompletedSegName).getSequenceNumber() < sequenceNumber) { + partitionIdToLastLLCCompletedSegmentMap.put(partitionGroupId, segMetadata.getSegmentName()); + } + } + } + return new ArrayList<>(partitionIdToLastLLCCompletedSegmentMap.values()); Review Comment: Removed the ArrayList and updated the return type as well. -- 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