hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [hadoop] goiri commented on a change in pull request #2332: HDFS-15594. Lazy calculate live datanodes in safe mode tip
Date Fri, 25 Sep 2020 13:17:57 GMT

goiri commented on a change in pull request #2332:
URL: https://github.com/apache/hadoop/pull/2332#discussion_r494462104



##########
File path: hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManagerSafeMode.java
##########
@@ -309,16 +311,21 @@ String getSafeModeTip() {
     }
 
     if (datanodeThreshold > 0) {
-      int numLive = blockManager.getDatanodeManager().getNumLiveDataNodes();
-      if (numLive < datanodeThreshold) {
-        msg += String.format(
-            "The number of live datanodes %d needs an additional %d live "
-                + "datanodes to reach the minimum number %d.%n",
-            numLive, (datanodeThreshold - numLive), datanodeThreshold);
+      if (isBlockThresholdMet) {
+        int numLive = blockManager.getDatanodeManager().getNumLiveDataNodes();
+        if (numLive < datanodeThreshold) {
+          msg += String.format(
+              "The number of live datanodes %d needs an additional %d live "
+                  + "datanodes to reach the minimum number %d.%n",
+              numLive, (datanodeThreshold - numLive), datanodeThreshold);
+        } else {
+          msg += String.format("The number of live datanodes %d has reached "
+                  + "the minimum number %d. ",
+              numLive, datanodeThreshold);
+        }
       } else {
-        msg += String.format("The number of live datanodes %d has reached "
-                + "the minimum number %d. ",
-            numLive, datanodeThreshold);
+        msg += "The number of live datanodes is not calculated " +

Review comment:
       As we are at it, does it make sense to use StringBuilder?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org


Mime
View raw message