abhishekrb19 commented on code in PR #16719:
URL: https://github.com/apache/druid/pull/16719#discussion_r1672966867


##########
server/src/main/java/org/apache/druid/server/coordinator/duty/KillUnusedSegments.java:
##########
@@ -141,18 +162,24 @@ private DruidCoordinatorRuntimeParams runInternal(final 
DruidCoordinatorRuntimeP
     final CoordinatorRunStats stats = params.getCoordinatorStats();
 
     final int availableKillTaskSlots = 
getAvailableKillTaskSlots(dynamicConfig, stats);
-    Collection<String> dataSourcesToKill = 
dynamicConfig.getSpecificDataSourcesToKillUnusedSegmentsIn();
-
-    if (availableKillTaskSlots > 0) {
-      // If no datasource has been specified, all are eligible for killing 
unused segments
-      if (CollectionUtils.isNullOrEmpty(dataSourcesToKill)) {
-        dataSourcesToKill = 
segmentsMetadataManager.retrieveAllDataSourceNames();
-      }
+    if (availableKillTaskSlots <= 0) {
+      log.info("Skipping KillUnusedSegments because there are no available 
kill task slots.");
+      return params;
+    }
 
-      lastKillTime = DateTimes.nowUtc();
-      killUnusedSegments(dataSourcesToKill, availableKillTaskSlots, stats);
+    final Set<String> dataSourcesToKill;
+    if 
(!CollectionUtils.isNullOrEmpty(dynamicConfig.getSpecificDataSourcesToKillUnusedSegmentsIn()))
 {
+      dataSourcesToKill = 
dynamicConfig.getSpecificDataSourcesToKillUnusedSegmentsIn();
+    } else {
+      // If no datasource has been specified, all are eligible for killing 
unused segments by default
+      dataSourcesToKill = segmentsMetadataManager.retrieveAllDataSourceNames();
     }
 
+    datasourceIterator.updateCandidates(dataSourcesToKill);

Review Comment:
   Yeah, exactly. If the datasources haven't changed, the iteration just 
resumes from the last position.



-- 
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]

Reply via email to