HDFS-6013. add rollingUpgrade information to latest UI. Contributed by Vinayakumar B.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/HDFS-5535@1573700 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Haohui Mai 2014-03-03 19:51:33 +00:00
parent 0a7db7f179
commit aa8a6e498a
6 changed files with 79 additions and 6 deletions

View File

@ -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)

View File

@ -94,4 +94,34 @@ public class RollingUpgradeInfo extends RollingUpgradeStatus {
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;
}
}
}

View File

@ -7247,6 +7247,20 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
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;

View File

@ -21,6 +21,7 @@ import java.util.Map;
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

View File

@ -72,14 +72,26 @@
<script type="text/x-dust-template" id="tmpl-dfshealth">
{#nn}
{@if cond="{DistinctVersionCount} > 1"}
{@if cond="{DistinctVersionCount} > 1 || '{RollingUpgradeStatus}'.length"}
<div class="alert alert-dismissable alert-info">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
There are {DistinctVersionCount} versions of datanodes currently live:
{#DistinctVersions}
{key} ({value}) {@sep},{/sep}
{/DistinctVersions}
{#RollingUpgradeStatus}
<p>Rolling upgrade started at {#helper_date_tostring value="{startTime}"/}. </br>
{#createdRollbackImages}
Rollback image has been created. Proceed to upgrade daemons.
{:else}
Rollback image has not been created.
{/createdRollbackImages}
</p>
{/RollingUpgradeStatus}
{@if cond="{DistinctVersionCount} > 1"}
There are {DistinctVersionCount} versions of datanodes currently live:
{#DistinctVersions}
{key} ({value}) {@sep},{/sep}
{/DistinctVersions}
{/if}
</div>
{/if}

View File

@ -44,6 +44,11 @@
for (var i in j) {
chunk.write('<tr><td>' + i + '</td><td>' + j[i] + '</td><td>' + params.type + '</td></tr>');
}
},
'helper_date_tostring' : function (chunk, ctx, bodies, params) {
var value = dust.helpers.tap(params.value, chunk, ctx);
return chunk.write('' + new Date(Number(value)).toLocaleString());
}
};