hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sj...@apache.org
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)
Date Fri, 14 Aug 2015 07:18:21 GMT
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 <kihwal@apache.org>
Authored: Fri May 8 09:32:07 2015 -0500
Committer: Sangjin Lee <sjlee@apache.org>
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? */


Mime
View raw message