sarvekshayr commented on code in PR #9376:
URL: https://github.com/apache/ozone/pull/9376#discussion_r2564383014
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/safemode/SCMSafeModeManager.java:
##########
@@ -225,6 +241,56 @@ public double getCurrentContainerThreshold() {
.getCurrentContainerThreshold();
}
+ private synchronized void startSafeModePeriodicLogger() {
+ if (!getInSafeMode() || safeModeLogExecutor != null) {
+ return;
+ }
+ safeModeLogExecutor = Executors.newScheduledThreadPool(1,
+ new ThreadFactoryBuilder()
+ .setNameFormat(scmContext.threadNamePrefix() +
"SCM-SafeMode-Log-%d")
+ .setDaemon(true)
+ .build());
+ safeModeLogExecutor.scheduleAtFixedRate(() -> {
+ try {
+ logSafeModeStatus();
+ } catch (Throwable t) {
+ LOG.warn("Safe mode periodic logger encountered an error", t);
+ }
+ }, 0L, safeModeLogIntervalMs, TimeUnit.MILLISECONDS);
+ LOG.info("Started periodic Safe Mode logging with interval {} ms",
safeModeLogIntervalMs);
+ }
+
+ private void logSafeModeStatus() {
+ if (!getInSafeMode()) {
+ stopSafeModePeriodicLogger();
+ return;
+ }
+ SafeModeStatus s = status.get();
Review Comment:
Please avoid single character variable names.
--
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]