zachjsh commented on code in PR #15710:
URL: https://github.com/apache/druid/pull/15710#discussion_r1456586701


##########
server/src/main/java/org/apache/druid/server/coordinator/duty/KillUnusedSegments.java:
##########
@@ -191,38 +207,43 @@ private int killUnusedSegments(
     if (0 < availableKillTaskSlots && 
!CollectionUtils.isNullOrEmpty(dataSourcesToKill)) {
       for (String dataSource : dataSourcesToKill) {
         if (submittedTasks >= availableKillTaskSlots) {
-          log.debug(StringUtils.format(
+          log.info(StringUtils.format(
               "Submitted [%d] kill tasks and reached kill task slot limit 
[%d]. Will resume "
               + "on the next coordinator cycle.", submittedTasks, 
availableKillTaskSlots));
           break;
         }
-        final Interval intervalToKill = findIntervalForKill(dataSource);
+        final DateTime maxUsedFlagLastUpdatedTime = 
DateTimes.nowUtc().minus(bufferPeriod);
+        final Interval intervalToKill = findIntervalForKill(dataSource, 
maxUsedFlagLastUpdatedTime);
         if (intervalToKill == null) {
           datasourceToLastKillIntervalEnd.remove(dataSource);
           continue;
         }
 
         try {
-          FutureUtils.getUnchecked(overlordClient.runKillTask(
-              TASK_ID_PREFIX,
-              dataSource,
-              intervalToKill,
-              maxSegmentsToKill
-          ), true);
+          FutureUtils.getUnchecked(
+              overlordClient.runKillTask(
+                  TASK_ID_PREFIX,
+                  dataSource,
+                  intervalToKill,
+                  maxSegmentsToKill,
+                  maxUsedFlagLastUpdatedTime
+              ),
+              true
+          );
           ++submittedTasks;
           datasourceToLastKillIntervalEnd.put(dataSource, 
intervalToKill.getEnd());
         }
         catch (Exception ex) {
-          log.error(ex, "Failed to submit kill task for dataSource [%s]", 
dataSource);
+          log.error(ex, "Failed to submit kill task for dataSource[%s] in 
interval[%s]", dataSource, intervalToKill);
           if (Thread.currentThread().isInterrupted()) {
-            log.warn("skipping kill task scheduling because thread is 
interrupted.");
+            log.warn("Skipping kill task scheduling because thread is 
interrupted.");
             break;
           }
         }
       }
     }
 
-    if (log.isDebugEnabled()) {
+    if (!log.isDebugEnabled()) {

Review Comment:
   Why change this condition? I think we only want to compute the subList in 
the log message here if debug logging is enabled?



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