Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3ADEF18913 for ; Fri, 14 Aug 2015 07:18:05 +0000 (UTC) Received: (qmail 69073 invoked by uid 500); 14 Aug 2015 07:17:49 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 68925 invoked by uid 500); 14 Aug 2015 07:17:49 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 66414 invoked by uid 99); 14 Aug 2015 07:17:48 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Aug 2015 07:17:48 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8D313E6822; Fri, 14 Aug 2015 07:17:48 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sjlee@apache.org To: common-commits@hadoop.apache.org Date: Fri, 14 Aug 2015 07:18:21 -0000 Message-Id: In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [35/43] hadoop git commit: HDFS-7894. Rolling upgrade readiness is not updated in jmx until query command is issued. Contributed by Brahma Reddy Battula. (cherry picked from commit 6f622672b62aa8d719060063ef0e47480cdc8655) HDFS-7894. Rolling upgrade readiness is not updated in jmx until query command is issued. Contributed by Brahma Reddy Battula. (cherry picked from commit 6f622672b62aa8d719060063ef0e47480cdc8655) (cherry picked from commit 802a5775f3522c57c60ae29ecb9533dbbfecfe76) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/995382c5 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/995382c5 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/995382c5 Branch: refs/heads/sjlee/hdfs-merge Commit: 995382c5234ad6c07f327e5d1f2a1c7e391a0b60 Parents: 5a28c6a Author: Kihwal Lee Authored: Fri May 8 09:32:07 2015 -0500 Committer: Sangjin Lee Committed: Thu Aug 13 16:35:27 2015 -0700 ---------------------------------------------------------------------- .../hdfs/server/namenode/FSNamesystem.java | 23 ++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/995382c5/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 5f396f7..2c6a65d 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -8417,11 +8417,30 @@ public class FSNamesystem implements Namesystem, FSClusterStats, @Override // NameNodeMXBean public RollingUpgradeInfo.Bean getRollingUpgradeStatus() { + if (!isRollingUpgrade()) { + return null; + } RollingUpgradeInfo upgradeInfo = getRollingUpgradeInfo(); - if (upgradeInfo != null) { + if (upgradeInfo.createdRollbackImages()) { return new RollingUpgradeInfo.Bean(upgradeInfo); } - return null; + readLock(); + try { + // check again after acquiring the read lock. + upgradeInfo = getRollingUpgradeInfo(); + if (upgradeInfo == null) { + return null; + } + if (!upgradeInfo.createdRollbackImages()) { + boolean hasRollbackImage = this.getFSImage().hasRollbackFSImage(); + upgradeInfo.setCreatedRollbackImages(hasRollbackImage); + } + } catch (IOException ioe) { + LOG.warn("Encountered exception setting Rollback Image", ioe); + } finally { + readUnlock(); + } + return new RollingUpgradeInfo.Bean(upgradeInfo); } /** Is rolling upgrade in progress? */