kfaraz commented on code in PR #19737:
URL: https://github.com/apache/druid/pull/19737#discussion_r3650025234
##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/KillUnusedSegmentsTask.java:
##########
@@ -236,12 +238,20 @@ public TaskStatus runTask(TaskToolbox toolbox) throws
Exception
break;
}
- unusedSegments = fetchNextBatchOfUnusedSegments(toolbox, nextBatchSize);
+ unusedSegmentsPlus = fetchNextBatchOfUnusedSegments(toolbox,
nextBatchSize);
+ if (unusedSegmentsPlus.isEmpty()) {
+ // No more segments eligible for kill, do not proceed further
+ break;
+ }
// Fetch locks each time as a revokal could have occurred in between
batches
final NavigableMap<DateTime, List<TaskLock>> taskLockMap
= getNonRevokedTaskLockMap(toolbox.getTaskActionClient());
+ final Set<DataSegment> unusedSegments = unusedSegmentsPlus.stream()
+
.map(DataSegmentPlus::getDataSegment)
+
.collect(Collectors.toSet());
+
if (!TaskLocks.isLockCoversSegments(taskLockMap, unusedSegments)) {
Review Comment:
The Set `unusedSegments` created above is also used later in this method.
--
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]