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


##########
server/src/main/java/org/apache/druid/server/coordinator/duty/KillUnusedSegments.java:
##########
@@ -85,46 +92,56 @@ public KillUnusedSegments(
       DruidCoordinatorConfig config
   )
   {
+    if (config.getCoordinatorKillPeriod().getMillis() < 
config.getCoordinatorIndexingPeriod().getMillis()) {
+      throw InvalidInput.exception(
+          "druid.coordinator.kill.period[%s] must be >= 
druid.coordinator.period.indexingPeriod[%s]",
+          config.getCoordinatorKillPeriod(),
+          config.getCoordinatorIndexingPeriod()
+      );
+    }
+    if (config.getCoordinatorKillMaxSegments() < 0) {
+      throw InvalidInput.exception(
+          "druid.coordinator.kill.maxSegments[%s] is invalid. It must be a 
positive integer.",
+          config.getCoordinatorKillMaxSegments()
+      );
+    }
     this.period = config.getCoordinatorKillPeriod().getMillis();
-    Preconditions.checkArgument(
-        this.period >= config.getCoordinatorIndexingPeriod().getMillis(),
-        "coordinator kill period must be greater than or equal to 
druid.coordinator.period.indexingPeriod"
-    );
-
-    this.ignoreRetainDuration = 
config.getCoordinatorKillIgnoreDurationToRetain();
-    this.retainDuration = 
config.getCoordinatorKillDurationToRetain().getMillis();
-    if (this.ignoreRetainDuration) {
+    this.ignoreDurationToRetain = 
config.getCoordinatorKillIgnoreDurationToRetain();
+    this.durationToRetain = 
config.getCoordinatorKillDurationToRetain().getMillis();
+    if (this.ignoreDurationToRetain) {
       log.debug(
-          "druid.coordinator.kill.durationToRetain [%s] will be ignored when 
discovering segments to kill "
-          + "because you have set 
druid.coordinator.kill.ignoreDurationToRetain to True.",
-          this.retainDuration
+          "druid.coordinator.kill.durationToRetain[%s] will be ignored when 
discovering segments to kill "
+          + "because druid.coordinator.kill.ignoreDurationToRetain is set to 
true.",
+          this.durationToRetain
       );
     }
     this.bufferPeriod = config.getCoordinatorKillBufferPeriod().getMillis();
 
     this.maxSegmentsToKill = config.getCoordinatorKillMaxSegments();
-    Preconditions.checkArgument(this.maxSegmentsToKill > 0, "coordinator kill 
maxSegments must be > 0");
-
     datasourceToLastKillIntervalEnd = new ConcurrentHashMap<>();
 
     log.info(
-        "Kill Task scheduling enabled with period [%s], retainDuration [%s], 
bufferPeriod [%s], maxSegmentsToKill [%s]",
+        "Kill task scheduling enabled with period[%s], durationToRetain[%s], 
bufferPeriod[%s], maxSegmentsToKill[%s]",
         this.period,
-        this.ignoreRetainDuration ? "IGNORING" : this.retainDuration,
+        this.ignoreDurationToRetain ? "IGNORING" : this.durationToRetain,
         this.bufferPeriod,
         this.maxSegmentsToKill
     );
 
     this.segmentsMetadataManager = segmentsMetadataManager;
     this.overlordClient = overlordClient;
+    this.lastKillTime = DateTimes.nowUtc();

Review Comment:
   Updated code to not initialized time here, so the old behavior is preserved. 
Bonus being no more `@VisibleForAnnotation`!



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