diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt index eca87112a7..976d30e31f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES_HDFS-5535.txt @@ -130,3 +130,7 @@ HDFS-5535 subtasks: HDFS-6034. Use DataNodeLayoutVersion for DN registration check and do not verify layout version if there is a rolling upgrade in progress. (szetszwo) + + HDFS-6013. add rollingUpgrade information to latest UI. + (Vinayakumar B via wheat9) + diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/RollingUpgradeInfo.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/RollingUpgradeInfo.java index 5e539491f4..98089bc6ef 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/RollingUpgradeInfo.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/RollingUpgradeInfo.java @@ -94,4 +94,34 @@ public String toString() { private static String timestamp2String(long timestamp) { return new Date(timestamp) + " (=" + timestamp + ")"; } + + public static class Bean { + private final String blockPoolId; + private final long startTime; + private final long finalizeTime; + private final boolean createdRollbackImages; + + public Bean(RollingUpgradeInfo f) { + this.blockPoolId = f.getBlockPoolId(); + this.startTime = f.startTime; + this.finalizeTime = f.finalizeTime; + this.createdRollbackImages = f.createdRollbackImages(); + } + + public String getBlockPoolId() { + return blockPoolId; + } + + public long getStartTime() { + return startTime; + } + + public long getFinalizeTime() { + return finalizeTime; + } + + public boolean isCreatedRollbackImages() { + return createdRollbackImages; + } + } } 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 76ee4cdf7d..932749bf29 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 @@ -7247,6 +7247,20 @@ public void setNeedRollbackFsImage(boolean needRollbackFsImage) { this.needRollbackFsImage = needRollbackFsImage; } + @Override // NameNodeMXBean + public RollingUpgradeInfo.Bean getRollingUpgradeStatus() { + readLock(); + try { + RollingUpgradeInfo upgradeInfo = getRollingUpgradeInfo(); + if (upgradeInfo != null) { + return new RollingUpgradeInfo.Bean(upgradeInfo); + } + return null; + } finally { + readUnlock(); + } + } + /** Is rolling upgrade in progress? */ public boolean isRollingUpgrade() { return rollingUpgradeInfo != null; diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java index fd46d54622..c9b4d55f46 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNodeMXBean.java @@ -21,6 +21,7 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; +import org.apache.hadoop.hdfs.protocol.RollingUpgradeInfo; /** * This is the JMX management interface for namenode information @@ -78,7 +79,14 @@ public interface NameNodeMXBean { * @return true, if upgrade is finalized */ public boolean isUpgradeFinalized(); - + + /** + * Gets the RollingUpgrade information + * + * @return Rolling upgrade information + */ + public RollingUpgradeInfo.Bean getRollingUpgradeStatus(); + /** * Gets total used space by data nodes for non DFS purposes such as storing * temporary files on the local file system diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html index 0df17b5388..8ef3e3f0c3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html @@ -72,14 +72,26 @@