szetszwo commented on code in PR #9953:
URL: https://github.com/apache/ozone/pull/9953#discussion_r3046926148


##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/SCMSafeModeManager.java:
##########
@@ -117,6 +120,31 @@ public SCMSafeModeManager(final ConfigurationSource conf,
       status.set(SafeModeStatus.OUT_OF_SAFE_MODE);
       emitSafeModeStatus();
     }
+
+    this.refreshIntervalMs = conf.getTimeDuration(
+        HDDS_SCM_SAFEMODE_RULE_REFRESH_INTERVAL,
+        HDDS_SCM_SAFEMODE_RULE_REFRESH_INTERVAL_DEFAULT,
+        TimeUnit.MILLISECONDS);
+    startRefreshExecutor(refreshIntervalMs);
+  }
+
+  private void startRefreshExecutor(long refreshIntervalMillis) {
+    final boolean enabled = refreshIntervalMillis > 0;
+    LOG.info("Container safe mode rule refresh: enabled? {}, {}={}ms",
+        enabled, HDDS_SCM_SAFEMODE_RULE_REFRESH_INTERVAL, 
refreshIntervalMillis);
+    if (!enabled) {
+      return;
+    }
+    final ScheduledExecutorService refreshExecutor = 
Executors.newSingleThreadScheduledExecutor(

Review Comment:
   Just found that there is already a safeModeLogExecutor.  We should just use 
it instead of creating a new ScheduledExecutorService.



##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/ha/SCMStateMachine.java:
##########
@@ -161,12 +161,6 @@ public CompletableFuture<Message> applyTransaction(
         // Ratis client, leaving SCM intact.
         applyTransactionFuture.completeExceptionally(ex);
       }
-
-      // After previous term transactions are applied, still in safe mode,
-      // perform refreshAndValidate to update the safemode rule state.
-      if (scm.isInSafeMode() && isStateMachineReady.get()) {
-        scm.getScmSafeModeManager().refreshAndValidate();
-      }

Review Comment:
   We should not remove it since the refresh can be disabled.



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