sumitagrawl commented on code in PR #8391:
URL: https://github.com/apache/ozone/pull/8391#discussion_r2101753105


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -5097,6 +5122,14 @@ private String reconfigureAllowListAllVolumes(String 
newVal) {
     return String.valueOf(allowListAllVolumes);
   }
 
+  private String reconfOzoneDirDeletingServiceInterval(String newVal) {

Review Comment:
   can this validation be registered by the service using this configuration, 
ie directorydeleteingService, and below logic also do validation, can that be 
used instead of using pattern if not null., configuration.getTimeDuration(
             OZONE_BLOCK_DELETING_SERVICE_INTERVAL,
             TimeUnit.MILLISECONDS);



##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/BackgroundService.java:
##########
@@ -103,8 +105,25 @@ public void runPeriodicalTaskNow() throws Exception {
   }
 
   // start service
-  public void start() {
-    exec.scheduleWithFixedDelay(service, 0, interval, unit);
+  public synchronized void start() {
+    if (scheduledHandle != null && !scheduledHandle.isCancelled()) {
+      LOG.warn("Background service {} is already running", serviceName);
+      return;
+    }
+    scheduledHandle = exec.scheduleWithFixedDelay(service, 0, interval, unit);
+  }
+
+  protected synchronized void setInterval(long newInterval, TimeUnit newUnit) {
+    this.interval = newInterval;
+    this.unit = newUnit;
+  }
+
+  public synchronized void stop() {
+    LOG.info("Stopping {}", serviceName);
+    if (scheduledHandle != null) {
+      scheduledHandle.cancel(false); // don't interrupt running tasks

Review Comment:
   We may need interrupt running task make wait till its completed. this is as 
when start() new task, should not conflict is already running task. 
DirectoryDeletingTask can have reverse impact.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java:
##########
@@ -5107,6 +5140,37 @@ public void validateReplicationConfig(ReplicationConfig 
replicationConfig)
     }
   }
 
+  private void initOrUpdateDirDeletingService(OzoneConfiguration conf) {

Review Comment:
   the owner of dirDeletingService is KeyManagerImpl, so OM should not have 
callback and handling here.



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