You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by ji...@apache.org on 2014/01/23 20:22:45 UTC
svn commit: r1560794 [2/2] - in
/hadoop/common/branches/HDFS-5698/hadoop-hdfs-project: hadoop-hdfs-httpfs/
hadoop-hdfs-httpfs/src/main/conf/
hadoop-hdfs-httpfs/src/main/java/org/apache/hadoop/fs/http/client/
hadoop-hdfs-httpfs/src/main/java/org/apache/...
Modified: hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html?rev=1560794&r1=1560793&r2=1560794&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html (original)
+++ hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.html Thu Jan 23 19:22:43 2014
@@ -23,25 +23,53 @@
<title>Namenode information</title>
</head>
<body>
+
+<header class="navbar navbar-inverse bs-docs-nav" role="banner">
+<div class="container">
+ <div class="navbar-header">
+ <a href="http://hadoop.apache.org/core" class="navbar-brand">Hadoop</a>
+ </div>
+
+ <ul class="nav navbar-nav" id="ui-tabs">
+ <li><a href="#tab-overview">Overview</a></li>
+ <li><a href="#tab-datanode">Datanodes</a></li>
+ <li><a href="#tab-snapshot">Snapshot</a></li>
+ <li><a href="#tab-startup-progress">Startup Progress</a></li>
+ <li class="dropdown">
+ <a href="#" class="dropdown-toggle" data-toggle="dropdown">Utilities <b class="caret"></b></a>
+ <ul class="dropdown-menu">
+ <li><a href="explorer.html">Browse the file system</a></li>
+ <li><a href="logs">Logs</a></li>
+ </ul>
+ </li>
+ </ul>
+</div>
+</header>
+
<div class="container">
-<div class="alert alert-danger" id="alert-panel" style="display:none">
-<button type="button" class="close" onclick="$('#alert-panel').hide();">×</button>
-<div class="alert-body" id="alert-panel-body"></div>
+
+<div id="alert-panel">
+ <div class="alert alert-danger">
+ <button type="button" class="close" onclick="$('#alert-panel').hide();">×</button>
+ <div class="alert-body" id="alert-panel-body"></div>
+ </div>
</div>
-<div id="panel"></div>
+
+<div class="tab-content">
+ <div class="tab-pane" id="tab-overview"></div>
+ <div class="tab-pane" id="tab-datanode"></div>
+ <div class="tab-pane" id="tab-snapshot"></div>
+ <div class="tab-pane" id="tab-startup-progress"></div>
</div>
+
<div class="row">
-<hr />
-<div class="col-xs-2"><p><a href="http://hadoop.apache.org/core">Hadoop</a>, 2013.</p></div>
-<div class="col-xs-1 pull-right"><a style="color: #ddd" href="dfshealth.jsp">Legacy UI</a></div>
+ <hr />
+ <div class="col-xs-2"><p><a href="http://hadoop.apache.org/core">Hadoop</a>, 2014.</p></div>
+ <div class="col-xs-1 pull-right"><a style="color: #ddd" href="dfshealth.jsp">Legacy UI</a></div>
+</div>
</div>
<script type="text/x-dust-template" id="tmpl-dfshealth">
-<div class="page-header">
- {#nnstat}
- <h1>NameNode '{HostAndPort}' ({State})</h1>
- {/nnstat}
-</div>
{#nn}
{@if cond="{DistinctVersionCount} > 1"}
@@ -71,238 +99,193 @@
{/if}
{/nn}
-<div class="panel panel-success">
- <div class="panel-heading">Overview</div>
- <div class="panel-body">
- {#nn}
- <table class="table table-bordered">
- <tr><th>Started:</th><td>{NNStarted}</td></tr>
- <tr><th>Version:</th><td>{Version}</td></tr>
- <tr><th>Compiled:</th><td>{CompileInfo}</td></tr>
- <tr><th>Cluster ID:</th><td>{ClusterId}</td></tr>
- <tr><th>Block Pool ID:</th><td>{BlockPoolId}</td></tr>
- </table>
- {/nn}
- </div>
-</div>
-
-<p><a href="explorer.html">Browse the filesystem</a></p>
-<p><a href="/logs/">NameNode Logs</a></p>
+<div class="page-header"><h1>Overview {#nnstat}<small>'{HostAndPort}' ({State})</small>{/nnstat}</h1></div>
+{#nn}
+<table class="table table-bordered table-striped">
+ <tr><th>Started:</th><td>{NNStarted}</td></tr>
+ <tr><th>Version:</th><td>{Version}</td></tr>
+ <tr><th>Compiled:</th><td>{CompileInfo}</td></tr>
+ <tr><th>Cluster ID:</th><td>{ClusterId}</td></tr>
+ <tr><th>Block Pool ID:</th><td>{BlockPoolId}</td></tr>
+</table>
+{/nn}
-<hr/>
+<div class="page-header"><h1>Summary</h1></div>
+<p>
+ Security is {#nnstat}{#SecurityEnabled}on{:else}off{/SecurityEnabled}{/nnstat}.</p>
+<p>{#nn}{#Safemode}{.}{:else}Safemode is off.{/Safemode}{/nn}</p>
+
+<p>
+ {#fs}
+ {FilesTotal} files and directories, {BlocksTotal} blocks = {@math key="{FilesTotal}" method="add" operand="{BlocksTotal}"/} total filesystem object(s).
+ {#helper_fs_max_objects/}
+ {/fs}
+</p>
+{#mem.HeapMemoryUsage}
+<p>Heap Memory used {used|fmt_bytes} of {committed|fmt_bytes} Heap Memory. Max Heap Memory is {max|fmt_bytes}. </p>
+{/mem.HeapMemoryUsage}
+
+{#mem.NonHeapMemoryUsage}
+<p>Non Heap Memory used {used|fmt_bytes} of {committed|fmt_bytes} Commited Non Heap Memory. Max Non Heap Memory is {max|fmt_bytes}. </p>
+{/mem.NonHeapMemoryUsage}
-<div class="panel panel-success">
- <div class="panel-heading">Cluster Summary</div>
- <div class="panel-body">
-
- <p>
- Security is {#nnstat}{#SecurityEnabled}on{:else}off{/SecurityEnabled}{/nnstat}.</p>
- <p>{#nn}{#Safemode}{.}{:else}Safemode is off.{/Safemode}{/nn}</p>
-
- <p>
- {#fs}
- {FilesTotal} files and directories, {BlocksTotal} blocks = {@math key="{FilesTotal}" method="add" operand="{BlocksTotal}"/} total filesystem object(s).
- {#helper_fs_max_objects/}
- {/fs}
- </p>
- {#mem.HeapMemoryUsage}
- <p>Heap Memory used {used|fmt_bytes} of {committed|fmt_bytes} Heap Memory. Max Heap Memory is {max|fmt_bytes}. </p>
- {/mem.HeapMemoryUsage}
-
- {#mem.NonHeapMemoryUsage}
- <p>Non Heap Memory used {used|fmt_bytes} of {committed|fmt_bytes} Commited Non Heap Memory. Max Non Heap Memory is {max|fmt_bytes}. </p>
- {/mem.NonHeapMemoryUsage}
-
- {#nn}
- <table class="table table-bordered table-striped">
- <tr><th> Configured Capacity:</th><td>{Total|fmt_bytes}</td></tr>
- <tr><th> DFS Used:</th><td>{Used|fmt_bytes}</td></tr>
- <tr><th> Non DFS Used:</th><td>{NonDfsUsedSpace|fmt_bytes}</td></tr>
- <tr><th> DFS Remaining:</th><td>{Free|fmt_bytes}</td></tr>
- <tr><th> DFS Used%:</th><td>{PercentUsed|fmt_percentage}</td></tr>
- <tr><th> DFS Remaining%:</th><td>{PercentRemaining|fmt_percentage}</td></tr>
- <tr><th> Block Pool Used:</th><td>{BlockPoolUsedSpace|fmt_bytes}</td></tr>
- <tr><th> Block Pool Used%:</th><td>{PercentBlockPoolUsed|fmt_percentage}</td></tr>
- <tr><th> DataNodes usages% (Min/Median/Max/stdDev): </th>
+{#nn}
+<table class="table table-bordered table-striped">
+ <tr><th> Configured Capacity:</th><td>{Total|fmt_bytes}</td></tr>
+ <tr><th> DFS Used:</th><td>{Used|fmt_bytes}</td></tr>
+ <tr><th> Non DFS Used:</th><td>{NonDfsUsedSpace|fmt_bytes}</td></tr>
+ <tr><th> DFS Remaining:</th><td>{Free|fmt_bytes}</td></tr>
+ <tr><th> DFS Used%:</th><td>{PercentUsed|fmt_percentage}</td></tr>
+ <tr><th> DFS Remaining%:</th><td>{PercentRemaining|fmt_percentage}</td></tr>
+ <tr><th> Block Pool Used:</th><td>{BlockPoolUsedSpace|fmt_bytes}</td></tr>
+ <tr><th> Block Pool Used%:</th><td>{PercentBlockPoolUsed|fmt_percentage}</td></tr>
+ <tr><th> DataNodes usages% (Min/Median/Max/stdDev): </th>
<td>{#NodeUsage.nodeUsage}{min} / {median} / {max} / {stdDev}{/NodeUsage.nodeUsage}</td></tr>
- {/nn}
-
- {#fs}
- <tr><th><a href="#nodelist-operation">Live Nodes</a></th><td>{NumLiveDataNodes} (Decommissioned: {NumDecomLiveDataNodes})</td></tr>
- <tr><th><a href="#nodelist-operation">Dead Nodes</a></th><td>{NumDeadDataNodes} (Decommissioned: {NumDecomDeadDataNodes})</td></tr>
- <tr><th><a href="#nodelist-decom">Decommissioning Nodes</a></th><td>{NumDecommissioningDataNodes}</td></tr>
- <tr><th title="Excludes missing blocks.">Number of Under-Replicated Blocks</th><td>{UnderReplicatedBlocks}</td></tr>
- {/fs}
- </table>
- </div>
-</div>
+{/nn}
-<hr/>
-<div class="panel panel-success">
- <div class="panel-heading">NameNode Journal Status</div>
- <div class="panel-body">
- <p><b>Current transaction ID:</b> {nn.JournalTransactionInfo.LastAppliedOrWrittenTxId}</p>
- <table class="table" title="NameNode Journals">
- <thead>
+{#fs}
+ <tr><th><a href="#tab-datanode">Live Nodes</a></th><td>{NumLiveDataNodes} (Decommissioned: {NumDecomLiveDataNodes})</td></tr>
+ <tr><th><a href="#tab-datanode">Dead Nodes</a></th><td>{NumDeadDataNodes} (Decommissioned: {NumDecomDeadDataNodes})</td></tr>
+ <tr><th><a href="#tab-datanode">Decommissioning Nodes</a></th><td>{NumDecommissioningDataNodes}</td></tr>
+ <tr><th title="Excludes missing blocks.">Number of Under-Replicated Blocks</th><td>{UnderReplicatedBlocks}</td></tr>
+{/fs}
+</table>
+
+<div class="page-header"><h1>Namenode Journal Status</h1></div>
+<p><b>Current transaction ID:</b> {nn.JournalTransactionInfo.LastAppliedOrWrittenTxId}</p>
+<table class="table" title="NameNode Journals">
+ <thead>
<tr><th>Journal Manager</th><th>State</th></tr>
- </thead>
- <tbody>
+ </thead>
+ <tbody>
{#nn.NameJournalStatus}
<tr><td>{manager}</td><td>{stream}</td></tr>
{/nn.NameJournalStatus}
- </tbody>
- </table>
- </div>
-</div>
+ </tbody>
+</table>
-<hr/>
-<div class="panel panel-success">
- <div class="panel-heading">NameNode Storage</div>
- <div class="panel-body">
- <table class="table" title="NameNode Storage">
- <thead><tr><td><b>Storage Directory</b></td><td><b>Type</b></td><td><b>State</b></td></tr></thead>
- {#nn.NameDirStatuses}
- {#active}{#helper_dir_status type="Active"/}{/active}
- {#failed}{#helper_dir_status type="Failed"/}{/failed}
- {/nn.NameDirStatuses}
- </table>
- </div>
-</div>
-<hr/>
+<div class="page-header"><h1>NameNode Storage</h1></div>
+<table class="table" title="NameNode Storage">
+ <thead><tr><td><b>Storage Directory</b></td><td><b>Type</b></td><td><b>State</b></td></tr></thead>
+ {#nn.NameDirStatuses}
+ {#active}{#helper_dir_status type="Active"/}{/active}
+ {#failed}{#helper_dir_status type="Failed"/}{/failed}
+ {/nn.NameDirStatuses}
+</table>
+</script>
-<div class="panel panel-success">
- <div class="panel-heading">Snapshot Summary</div>
- <div class="panel-body">
- {#fs.SnapshotStats}
- <table class="table" title="Snapshot Summary">
- <thead><tr><td><b>Snapshottable directories</b></td>
- <td><b>Snapshotted directories</b></td></tr>
- </thead>
- <tbody>
- <tr>
- <td>{SnapshottableDirectories}</td>
- <td>{Snapshots}</td>
- </tr>
- </tbody>
- </table>
- {/fs.SnapshotStats}
- </div>
-</div>
-<hr/>
+<script type="text/x-dust-template" id="tmpl-snapshot">
+<div class="page-header"><h1>Snapshot Summary</h1></div>
+<p><b>Snapshottable directories</b>: {SnapshottableDirectories}</p>
+<p><b>Snapshotted directories</b>: {Snapshots}</p>
+</script>
-{#startup}
-<div class="panel panel-success">
- <div class="panel-heading">Startup Progress</div>
- <div class="panel-body">
- <p>Elapsed Time: {elapsedTime|fmt_time}, Percent Complete: {percentComplete|fmt_percentage}</p>
- <table class="table">
- <thead>
- <tr>
+<script type="text/x-dust-template" id="tmpl-datanode">
+<div class="page-header"><h1>Datanode Information</h1></div>
+<div class="page-header"><h1><small>In operation</small></h1></div>
+<small>
+<table class="table">
+ <thead>
+ <tr>
+ <th>Node</th>
+ <th>Last contact</th>
+ <th>Admin State</th>
+ <th>Capacity</th>
+ <th>Used</th>
+ <th>Non DFS Used</th>
+ <th>Remaining</th>
+ <th>Blocks</th>
+ <th>Block pool used</th>
+ <th>Failed Volumes</th>
+ <th>Version</th>
+ </tr>
+ </thead>
+ {#LiveNodes}
+ <tr>
+ <td>{name} ({xferaddr})</td>
+ <td>{lastContact}</td>
+ <td>{adminState}</td>
+ <td>{capacity|fmt_bytes}</td>
+ <td>{used|fmt_bytes}</td>
+ <td>{nonDfsUsedSpace|fmt_bytes}</td>
+ <td>{remaining|fmt_bytes}</td>
+ <td>{numBlocks}</td>
+ <td>{blockPoolUsed|fmt_bytes} ({blockPoolUsedPercent|fmt_percentage})</td>
+ <td>{volfails}</td>
+ <td>{version}</td>
+ </tr>
+ {/LiveNodes}
+ {#DeadNodes}
+ <tr class="danger">
+ <td>{name} ({xferaddr})</td>
+ <td>{lastContact}</td>
+ <td>Dead{?decomissioned}, Decomissioned{/decomissioned}</td>
+ <td>-</td>
+ <td>-</td>
+ <td>-</td>
+ <td>-</td>
+ <td>-</td>
+ <td>-</td>
+ <td>-</td>
+ <td>-</td>
+ </tr>
+ {/DeadNodes}
+</table>
+</small>
+
+<div class="page-header"><h1><small>Decomissioning</small></h1></div>
+<small>
+<table class="table">
+ <thead>
+ <tr>
+ <th>Node</th>
+ <th>Last contact</th>
+ <th>Under replicated blocks</th>
+ <th>Blocks with no live replicas</th>
+ <th>Under Replicated Blocks <br/>In files under construction</th>
+ </tr>
+ </thead>
+ {#DecomNodes}
+ <tr>
+ <td>{name} ({xferaddr})</td>
+ <td>{lastContact}</td>
+ <td>{underReplicatedBlocks}</td>
+ <td>{decommissionOnlyReplicas}</td>
+ <td>{underReplicateInOpenFiles}</td>
+ </tr>
+ {/DecomNodes}
+</table>
+</small>
+</script>
+
+<script type="text/x-dust-template" id="tmpl-startup-progress">
+<div class="page-header"><h1>Startup Progress</h1></div>
+<p>Elapsed Time: {elapsedTime|fmt_time}, Percent Complete: {percentComplete|fmt_percentage}</p>
+<table class="table">
+ <thead>
+ <tr class="active">
<th>Phase</th>
- <th>Completion</th>
- <th>Elapsed Time</th>
+ <th style="text-align:center">Completion</th>
+ <th style="text-align:center">Elapsed Time</th>
</tr>
- </thead>
- <tbody>
+ </thead>
+ <tbody>
{#phases}
<tr class="phase">
<td class="startupdesc">{desc} {file} {size|fmt_bytes}</td>
- <td>{percentComplete|fmt_percentage}</td>
- <td>{elapsedTime|fmt_time}</td>
+ <td style="text-align:center">{percentComplete|fmt_percentage}</td>
+ <td style="text-align:center">{elapsedTime|fmt_time}</td>
</tr>
{#steps root_file=file}
<tr class="step">
<td class="startupdesc">{stepDesc} {stepFile} {stepSize|fmt_bytes} ({count}/{total})</td>
- <td>{percentComplete|fmt_percentage}</td>
+ <td style="text-align:center">{percentComplete|fmt_percentage}</td>
<td></td>
</tr>
{/steps}
{/phases}
- </table>
- </div>
-</div>
-{/startup}
-
-<hr/>
-<div class="panel panel-success">
- <div class="panel-heading">Datanode Information</div>
- <div class="panel-body">
- <div class="panel panel-default" id="nodelist-operation">
- <div class="panel-heading">Nodes in operation</div>
- <div class="panel-body">
- <table class="table">
- <thead>
- <tr>
- <th>Node</th>
- <th>Last contact</th>
- <th>Admin State</th>
- <th>Capacity</th>
- <th>Used</th>
- <th>Non DFS Used</th>
- <th>Remaining</th>
- <th>Blocks</th>
- <th>Block pool used</th>
- <th>Failed Volumes</th>
- </tr>
- </thead>
- {#nn.LiveNodes}
- <tr>
- <td>{name} ({xferaddr})</td>
- <td>{lastContact}</td>
- <td>{adminState}</td>
- <td>{capacity|fmt_bytes}</td>
- <td>{used|fmt_bytes}</td>
- <td>{nonDfsUsedSpace|fmt_bytes}</td>
- <td>{remaining|fmt_bytes}</td>
- <td>{numBlocks}</td>
- <td>{blockPoolUsed|fmt_bytes} ({blockPoolUsedPercent|fmt_percentage})</td>
- <td>{volfails}</td>
- </tr>
- {/nn.LiveNodes}
- {#nn.DeadNodes}
- <tr class="danger">
- <td>{name} ({xferaddr})</td>
- <td>{lastContact}</td>
- <td>Dead{?decomissioned}, Decomissioned{/decomissioned}</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- <td>-</td>
- </tr>
- {/nn.DeadNodes}
- </table>
- </div>
- </div>
- <div class="panel panel-default" id="nodelist-decom">
- <div class="panel-heading">Nodes being decomissioned</div>
- <div class="panel-body">
- <table class="table">
- <thead>
- <tr>
- <th>Node</th>
- <th>Last contact</th>
- <th>Under replicated blocks</th>
- <th>Blocks with no live replicas</th>
- <th>Under Replicated Blocks <br/>In files under construction</th>
- </tr>
- </thead>
- {#nn.DecomNodes}
- <tr>
- <td>{name} ({xferaddr})</td>
- <td>{lastContact}</td>
- <td>{underReplicatedBlocks}</td>
- <td>{decommissionOnlyReplicas}</td>
- <td>{underReplicateInOpenFiles}</td>
- </tr>
- {/nn.DecomNodes}
- </table>
- </div>
- </div>
- </div>
-</div>
+ </tbody>
+</table>
</script>
<script type="text/javascript" src="/static/jquery-1.10.2.min.js">
Modified: hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js?rev=1560794&r1=1560793&r2=1560794&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js (original)
+++ hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/hdfs/dfshealth.js Thu Jan 23 19:22:43 2014
@@ -18,10 +18,20 @@
(function () {
"use strict";
- var data = {};
+ dust.loadSource(dust.compile($('#tmpl-dfshealth').html(), 'dfshealth'));
+ dust.loadSource(dust.compile($('#tmpl-startup-progress').html(), 'startup-progress'));
+ dust.loadSource(dust.compile($('#tmpl-datanode').html(), 'datanode-info'));
+ dust.loadSource(dust.compile($('#tmpl-snapshot').html(), 'snapshot-info'));
+
+ function load_overview() {
+ var BEANS = [
+ {"name": "nn", "url": "/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo"},
+ {"name": "nnstat", "url": "/jmx?qry=Hadoop:service=NameNode,name=NameNodeStatus"},
+ {"name": "fs", "url": "/jmx?qry=Hadoop:service=NameNode,name=FSNamesystemState"},
+ {"name": "mem", "url": "/jmx?qry=java.lang:type=Memory"},
+ ];
- function render() {
- var helpers = {
+ var HELPERS = {
'helper_fs_max_objects': function (chunk, ctx, bodies, params) {
var o = ctx.current();
if (o.MaxObjects > 0) {
@@ -37,35 +47,53 @@
}
};
- var base = dust.makeBase(helpers);
+ var data = {};
- dust.loadSource(dust.compile($('#tmpl-dfshealth').html(), 'dfshealth'));
- dust.render('dfshealth', base.push(data), function(err, out) {
- $('#panel').html(out);
- });
- }
-
- var BEANS = [
- {"name": "nn", "url": "/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo"},
- {"name": "nnstat", "url": "/jmx?qry=Hadoop:service=NameNode,name=NameNodeStatus"},
- {"name": "fs", "url": "/jmx?qry=Hadoop:service=NameNode,name=FSNamesystemState"},
- {"name": "mem", "url": "/jmx?qry=java.lang:type=Memory"},
- {"name": "startup", "url": "/startupProgress"}
- ];
-
- // Workarounds for the fact that JMXJsonServlet returns non-standard JSON strings
- function data_workaround(d) {
- function node_map_to_array(nodes) {
- var res = [];
- for (var n in nodes) {
- var p = nodes[n];
- p.name = n;
- res.push(p);
- }
- return res;
+ // Workarounds for the fact that JMXJsonServlet returns non-standard JSON strings
+ function data_workaround(d) {
+ d.nn.JournalTransactionInfo = JSON.parse(d.nn.JournalTransactionInfo);
+ d.nn.NameJournalStatus = JSON.parse(d.nn.NameJournalStatus);
+ d.nn.NameDirStatuses = JSON.parse(d.nn.NameDirStatuses);
+ d.nn.NodeUsage = JSON.parse(d.nn.NodeUsage);
+ d.nn.CorruptFiles = JSON.parse(d.nn.CorruptFiles);
+ return d;
}
- function startup_progress_workaround(r) {
+ load_json(
+ BEANS,
+ function(d) {
+ for (var k in d) {
+ data[k] = d[k].beans[0];
+ }
+ data = data_workaround(data);
+ render();
+ },
+ function (url, jqxhr, text, err) {
+ show_err_msg('<p>Failed to retrieve data from ' + url + ', cause: ' + err + '</p>');
+ });
+
+ function render() {
+ var base = dust.makeBase(HELPERS);
+ dust.render('dfshealth', base.push(data), function(err, out) {
+ $('#tab-overview').html(out);
+ $('a[href="#tab-datanode"]').click(load_datanode_info);
+ $('#ui-tabs a[href="#tab-overview"]').tab('show');
+ });
+ }
+ }
+ $('#ui-tabs a[href="#tab-overview"]').click(load_overview);
+
+ function show_err_msg(msg) {
+ $('#alert-panel-body').html(msg);
+ $('#alert-panel').show();
+ }
+
+ function ajax_error_handler(url, jqxhr, text, err) {
+ show_err_msg('<p>Failed to retrieve data from ' + url + ', cause: ' + err + '</p>');
+ }
+
+ function load_startup_progress() {
+ function workaround(r) {
function rename_property(o, s, d) {
if (o[s] !== undefined) {
o[d] = o[s];
@@ -86,36 +114,66 @@
});
return r;
}
+ $.get('/startupProgress', function (resp) {
+ var data = workaround(resp);
+ dust.render('startup-progress', data, function(err, out) {
+ $('#tab-startup-progress').html(out);
+ $('#ui-tabs a[href="#tab-startup-progress"]').tab('show');
+ });
+ }).error(ajax_error_handler);
+ }
+
+ $('#ui-tabs a[href="#tab-startup-progress"]').click(load_startup_progress);
+
+ function load_datanode_info() {
+ function workaround(r) {
+ function node_map_to_array(nodes) {
+ var res = [];
+ for (var n in nodes) {
+ var p = nodes[n];
+ p.name = n;
+ res.push(p);
+ }
+ return res;
+ }
+
+ r.LiveNodes = node_map_to_array(JSON.parse(r.LiveNodes));
+ r.DeadNodes = node_map_to_array(JSON.parse(r.DeadNodes));
+ r.DecomNodes = node_map_to_array(JSON.parse(r.DecomNodes));
+ return r;
+ }
- d.nn.JournalTransactionInfo = JSON.parse(d.nn.JournalTransactionInfo);
- d.nn.NameJournalStatus = JSON.parse(d.nn.NameJournalStatus);
- d.nn.NameDirStatuses = JSON.parse(d.nn.NameDirStatuses);
- d.nn.NodeUsage = JSON.parse(d.nn.NodeUsage);
- d.nn.LiveNodes = node_map_to_array(JSON.parse(d.nn.LiveNodes));
- d.nn.DeadNodes = node_map_to_array(JSON.parse(d.nn.DeadNodes));
- d.nn.DecomNodes = node_map_to_array(JSON.parse(d.nn.DecomNodes));
- d.nn.CorruptFiles = JSON.parse(d.nn.CorruptFiles);
-
- d.fs.SnapshotStats = JSON.parse(d.fs.SnapshotStats);
- d.startup = startup_progress_workaround(d.startup);
- return d;
+ $.get('/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo', function (resp) {
+ var data = workaround(resp.beans[0]);
+ dust.render('datanode-info', data, function(err, out) {
+ $('#tab-datanode').html(out);
+ $('#ui-tabs a[href="#tab-datanode"]').tab('show');
+ });
+ }).error(ajax_error_handler);
}
- function show_err_msg(msg) {
- $('#alert-panel-body').html(msg);
- $('#alert-panel').show();
+ $('a[href="#tab-datanode"]').click(load_datanode_info);
+
+ function load_snapshot_info() {
+ $.get('/jmx?qry=Hadoop:service=NameNode,name=FSNamesystemState', function (resp) {
+ var data = JSON.parse(resp.beans[0].SnapshotStats);
+ dust.render('snapshot-info', data, function(err, out) {
+ $('#tab-snapshot').html(out);
+ $('#ui-tabs a[href="#tab-snapshot"]').tab('show');
+ });
+ }).error(ajax_error_handler);
}
- load_json(
- BEANS,
- function(d) {
- for (var k in d) {
- data[k] = k === "startup" ? d[k] : d[k].beans[0];
- }
- data = data_workaround(data);
- render();
- },
- function (url, jqxhr, text, err) {
- show_err_msg('<p>Failed to retrieve data from ' + url + ', cause: ' + err + '</p>');
- });
+ $('#ui-tabs a[href="#tab-snapshot"]').click(load_snapshot_info);
+
+ var hash = window.location.hash;
+ if (hash === "#tab-datanode") {
+ load_datanode_info();
+ } else if (hash === "#tab-snapshot") {
+ load_snapshot_info();
+ } else if (hash === "#tab-startup-progress") {
+ load_startup_progress();
+ } else {
+ load_overview();
+ }
})();
Propchange: hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/secondary:r1559902-1560793
Modified: hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css?rev=1560794&r1=1560793&r2=1560794&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css (original)
+++ hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/main/webapps/static/hadoop.css Thu Jan 23 19:22:43 2014
@@ -192,4 +192,24 @@ div.security {
.panel-success > .panel-heading {
color: #fff !important;
background-color: #5FA33E !important;
+}
+
+header.bs-docs-nav, header.bs-docs-nav .navbar-brand {
+ border-radius: 0px;
+ background-color: #5fa33e;
+ color: #fff;
+}
+
+#ui-tabs > li > a {
+ color: #dcf0d3;
+}
+
+#ui-tabs .active a {
+ color: #fff;
+ background-color: #446633;
+}
+
+#alert-panel {
+ margin-top:20px;
+ display: none;
}
\ No newline at end of file
Propchange: hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/hdfs:r1559902-1560793
Modified: hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAuditLogs.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAuditLogs.java?rev=1560794&r1=1560793&r2=1560794&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAuditLogs.java (original)
+++ hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAuditLogs.java Thu Jan 23 19:22:43 2014
@@ -18,16 +18,17 @@
package org.apache.hadoop.hdfs.server.namenode;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
import java.util.regex.Pattern;
import org.apache.commons.logging.impl.Log4JLogger;
@@ -46,6 +47,8 @@ import org.apache.hadoop.hdfs.web.WebHdf
import org.apache.hadoop.security.AccessControlException;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.test.PathUtils;
+import org.apache.log4j.Appender;
+import org.apache.log4j.AsyncAppender;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
@@ -54,13 +57,30 @@ import org.apache.log4j.RollingFileAppen
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
/**
* A JUnit test that audit logs are generated
*/
+@RunWith(Parameterized.class)
public class TestAuditLogs {
static final String auditLogFile = PathUtils.getTestDirName(TestAuditLogs.class) + "/TestAuditLogs-audit.log";
+ boolean useAsyncLog;
+ @Parameters
+ public static Collection<Object[]> data() {
+ Collection<Object[]> params = new ArrayList<Object[]>();
+ params.add(new Object[]{new Boolean(false)});
+ params.add(new Object[]{new Boolean(true)});
+ return params;
+ }
+
+ public TestAuditLogs(boolean useAsyncLog) {
+ this.useAsyncLog = useAsyncLog;
+ }
+
// Pattern for:
// allowed=(true|false) ugi=name ip=/address cmd={cmd} src={path} dst=null perm=null
static final Pattern auditPattern = Pattern.compile(
@@ -84,17 +104,28 @@ public class TestAuditLogs {
@Before
public void setupCluster() throws Exception {
+ // must configure prior to instantiating the namesystem because it
+ // will reconfigure the logger if async is enabled
+ configureAuditLogs();
conf = new HdfsConfiguration();
final long precision = 1L;
conf.setLong(DFSConfigKeys.DFS_NAMENODE_ACCESSTIME_PRECISION_KEY, precision);
conf.setLong(DFSConfigKeys.DFS_BLOCKREPORT_INTERVAL_MSEC_KEY, 10000L);
conf.setBoolean(DFSConfigKeys.DFS_WEBHDFS_ENABLED_KEY, true);
+ conf.setBoolean(DFSConfigKeys.DFS_NAMENODE_AUDIT_LOG_ASYNC_KEY, useAsyncLog);
util = new DFSTestUtil.Builder().setName("TestAuditAllowed").
setNumFiles(20).build();
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(4).build();
fs = cluster.getFileSystem();
util.createFiles(fs, fileName);
+ // make sure the appender is what it's supposed to be
+ Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
+ @SuppressWarnings("unchecked")
+ List<Appender> appenders = Collections.list(logger.getAllAppenders());
+ assertEquals(1, appenders.size());
+ assertEquals(useAsyncLog, appenders.get(0) instanceof AsyncAppender);
+
fnames = util.getFileNames(fileName);
util.waitReplication(fs, fileName, (short)3);
userGroupInfo = UserGroupInformation.createUserForTesting(username, groups);
@@ -203,6 +234,7 @@ public class TestAuditLogs {
try {
hftpFs = (HftpFileSystem) new Path(hftpUri).getFileSystem(conf);
InputStream istream = hftpFs.open(file);
+ @SuppressWarnings("unused")
int val = istream.read();
istream.close();
@@ -234,6 +266,12 @@ public class TestAuditLogs {
/** Sets up log4j logger for auditlogs */
private void setupAuditLogs() throws IOException {
+ Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
+ // enable logging now that the test is ready to run
+ logger.setLevel(Level.INFO);
+ }
+
+ private void configureAuditLogs() throws IOException {
// Shutdown the LogManager to release all logger open file handles.
// Unfortunately, Apache commons logging library does not provide
// means to release underlying loggers. For additional info look up
@@ -245,7 +283,8 @@ public class TestAuditLogs {
assertTrue(file.delete());
}
Logger logger = ((Log4JLogger) FSNamesystem.auditLog).getLogger();
- logger.setLevel(Level.INFO);
+ // disable logging while the cluster startup preps files
+ logger.setLevel(Level.OFF);
PatternLayout layout = new PatternLayout("%m%n");
RollingFileAppender appender = new RollingFileAppender(layout, auditLogFile);
logger.addAppender(appender);
Modified: hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestINodeFile.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestINodeFile.java?rev=1560794&r1=1560793&r2=1560794&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestINodeFile.java (original)
+++ hadoop/common/branches/HDFS-5698/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestINodeFile.java Thu Jan 23 19:22:43 2014
@@ -26,6 +26,7 @@ import static org.junit.Assert.fail;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -952,7 +953,76 @@ public class TestINodeFile {
}
}
}
-
+ @Test
+ public void testLocationLimitInListingOps() throws Exception {
+ final Configuration conf = new Configuration();
+ conf.setInt(DFSConfigKeys.DFS_LIST_LIMIT, 9); // 3 blocks * 3 replicas
+ MiniDFSCluster cluster = null;
+ try {
+ cluster = new MiniDFSCluster.Builder(conf).numDataNodes(3).build();
+ cluster.waitActive();
+ final DistributedFileSystem hdfs = cluster.getFileSystem();
+ ArrayList<String> source = new ArrayList<String>();
+
+ // tmp1 holds files with 3 blocks, 3 replicas
+ // tmp2 holds files with 3 blocks, 1 replica
+ hdfs.mkdirs(new Path("/tmp1"));
+ hdfs.mkdirs(new Path("/tmp2"));
+
+ source.add("f1");
+ source.add("f2");
+
+ int numEntries = source.size();
+ for (int j=0;j<numEntries;j++) {
+ DFSTestUtil.createFile(hdfs, new Path("/tmp1/"+source.get(j)), 4096,
+ 3*1024-100, 1024, (short) 3, 0);
+ }
+
+ byte[] start = HdfsFileStatus.EMPTY_NAME;
+ for (int j=0;j<numEntries;j++) {
+ DirectoryListing dl = cluster.getNameNodeRpc().getListing("/tmp1",
+ start, true);
+ assertTrue(dl.getPartialListing().length == 1);
+ for (int i=0;i<dl.getPartialListing().length; i++) {
+ source.remove(dl.getPartialListing()[i].getLocalName());
+ }
+ start = dl.getLastName();
+ }
+ // Verify we have listed all entries in the directory.
+ assertTrue(source.size() == 0);
+
+ // Now create 6 files, each with 3 locations. Should take 2 iterations of 3
+ source.add("f1");
+ source.add("f2");
+ source.add("f3");
+ source.add("f4");
+ source.add("f5");
+ source.add("f6");
+ numEntries = source.size();
+ for (int j=0;j<numEntries;j++) {
+ DFSTestUtil.createFile(hdfs, new Path("/tmp2/"+source.get(j)), 4096,
+ 3*1024-100, 1024, (short) 1, 0);
+ }
+
+ start = HdfsFileStatus.EMPTY_NAME;
+ for (int j=0;j<numEntries/3;j++) {
+ DirectoryListing dl = cluster.getNameNodeRpc().getListing("/tmp2",
+ start, true);
+ assertTrue(dl.getPartialListing().length == 3);
+ for (int i=0;i<dl.getPartialListing().length; i++) {
+ source.remove(dl.getPartialListing()[i].getLocalName());
+ }
+ start = dl.getLastName();
+ }
+ // Verify we have listed all entries in tmp2.
+ assertTrue(source.size() == 0);
+ } finally {
+ if (cluster != null) {
+ cluster.shutdown();
+ }
+ }
+ }
+
@Test
public void testFilesInGetListingOps() throws Exception {
final Configuration conf = new Configuration();