This is an automated email from the ASF dual-hosted git repository.

elek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 448ec75  HDDS-4639. Safemode wait may end without checking (#1751)
448ec75 is described below

commit 448ec75b34e0c5cb9c49118b52009eecab0a6436
Author: Doroszlai, Attila <[email protected]>
AuthorDate: Thu Jan 7 11:55:45 2021 +0100

    HDDS-4639. Safemode wait may end without checking (#1751)
---
 .../hadoop/hdds/scm/cli/SafeModeWaitSubcommand.java  | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git 
a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/SafeModeWaitSubcommand.java
 
b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/SafeModeWaitSubcommand.java
index e3fb5c1..49a40a2 100644
--- 
a/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/SafeModeWaitSubcommand.java
+++ 
b/hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/SafeModeWaitSubcommand.java
@@ -59,21 +59,25 @@ public class SafeModeWaitSubcommand implements 
Callable<Void> {
 
     while (getRemainingTimeInSec() > 0) {
       try (ScmClient scmClient = scmOption.createScmClient()) {
-        while (getRemainingTimeInSec() > 0) {
-
-          boolean isSafeModeActive = scmClient.inSafeMode();
-
-          if (!isSafeModeActive) {
+        long remainingTime;
+        do {
+          if (!scmClient.inSafeMode()) {
             LOG.info("SCM is out of safe mode.");
             return null;
-          } else {
+          }
+
+          remainingTime = getRemainingTimeInSec();
+
+          if (remainingTime > 0) {
             LOG.info(
                 "SCM is in safe mode. Will retry in 1 sec. Remaining time "
                     + "(sec): {}",
-                getRemainingTimeInSec());
+                remainingTime);
             Thread.sleep(1000);
+          } else {
+            LOG.info("SCM is in safe mode. No more retries.");
           }
-        }
+        } while (remainingTime > 0);
       } catch (Exception ex) {
         LOG.info(
             "SCM is not available (yet?). Error is {}. Will retry in 1 sec. "


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to