Jackie-Jiang commented on code in PR #8786:
URL: https://github.com/apache/pinot/pull/8786#discussion_r884028164
##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/realtimetoofflinesegments/RealtimeToOfflineSegmentsTaskGenerator.java:
##########
@@ -243,41 +243,42 @@ public List<PinotTaskConfig>
generateTasks(List<TableConfig> tableConfigs) {
}
/**
- * Fetch completed (non-consuming) segment and partition information
+ * Fetch completed (DONE/UPLOADED) segment and partition information
+ *
* @param realtimeTableName the realtime table name
- * @param completedSegmentsZKMetadata list for collecting the completed
segments ZK metadata
- * @param partitionToLatestCompletedSegmentName map for collecting the
partitionId to the latest completed segment
- * name
+ * @param completedSegmentsZKMetadata list for collecting the completed
(DONE/UPLOADED) segments ZK metadata
+ * @param partitionToLatestLLCSegmentName map for collecting the partitionId
to the latest LLC segment name
* @param allPartitions set for collecting all partition ids
*/
private void getCompletedSegmentsInfo(String realtimeTableName,
List<SegmentZKMetadata> completedSegmentsZKMetadata,
- Map<Integer, String> partitionToLatestCompletedSegmentName, Set<Integer>
allPartitions) {
+ Map<Integer, String> partitionToLatestLLCSegmentName, Set<Integer>
allPartitions) {
List<SegmentZKMetadata> segmentsZKMetadata =
_clusterInfoAccessor.getSegmentsZKMetadata(realtimeTableName);
Map<Integer, LLCSegmentName> latestLLCSegmentNameMap = new HashMap<>();
for (SegmentZKMetadata segmentZKMetadata : segmentsZKMetadata) {
- LLCSegmentName llcSegmentName = new
LLCSegmentName(segmentZKMetadata.getSegmentName());
- allPartitions.add(llcSegmentName.getPartitionGroupId());
-
- if (segmentZKMetadata.getStatus().equals(Segment.Realtime.Status.DONE)) {
+ Segment.Realtime.Status status = segmentZKMetadata.getStatus();
+ if (status.isCompleted()) {
completedSegmentsZKMetadata.add(segmentZKMetadata);
- latestLLCSegmentNameMap.compute(llcSegmentName.getPartitionGroupId(),
- (partitionGroupId, latestLLCSegmentName) -> {
- if (latestLLCSegmentName == null) {
- return llcSegmentName;
- } else {
- if (llcSegmentName.getSequenceNumber() >
latestLLCSegmentName.getSequenceNumber()) {
- return llcSegmentName;
- } else {
- return latestLLCSegmentName;
- }
- }
- });
+ }
+ LLCSegmentName llcSegmentName =
LLCSegmentName.getLLCSegmentName(segmentZKMetadata.getSegmentName());
+ if (llcSegmentName != null) {
Review Comment:
Done
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]