From common-issues-return-207288-archive-asf-public=cust-asf.ponee.io@hadoop.apache.org Fri Sep 25 13:17:59 2020 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mailroute1-lw-us.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id 361581806D6 for ; Fri, 25 Sep 2020 15:17:59 +0200 (CEST) Received: from mail.apache.org (localhost [127.0.0.1]) by mailroute1-lw-us.apache.org (ASF Mail Server at mailroute1-lw-us.apache.org) with SMTP id 5C1D21253DC for ; Fri, 25 Sep 2020 13:17:58 +0000 (UTC) Received: (qmail 63456 invoked by uid 500); 25 Sep 2020 13:17:58 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 63417 invoked by uid 99); 25 Sep 2020 13:17:58 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Sep 2020 13:17:58 +0000 From: =?utf-8?q?GitBox?= To: common-issues@hadoop.apache.org Subject: =?utf-8?q?=5BGitHub=5D_=5Bhadoop=5D_goiri_commented_on_a_change_in_pull_requ?= =?utf-8?q?est_=232332=3A_HDFS-15594=2E_Lazy_calculate_live_datanodes_in_saf?= =?utf-8?q?e_mode_tip?= Message-ID: <160103987794.32230.1259109579379068748.asfpy@gitbox.apache.org> Date: Fri, 25 Sep 2020 13:17:57 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit In-Reply-To: References: 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