HDFS-5759. Merging r1568578 from trunk to branch-2

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1568581 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Arpit Agarwal 2014-02-15 01:27:12 +00:00
parent 54d43e5b41
commit f0e7b22059
3 changed files with 45 additions and 26 deletions

View File

@ -160,6 +160,9 @@ Release 2.4.0 - UNRELEASED
HDFS-5953. TestBlockReaderFactory fails in trunk. (Akira Ajisaka via wang) HDFS-5953. TestBlockReaderFactory fails in trunk. (Akira Ajisaka via wang)
HDFS-5759. Web UI does not show up during the period of loading FSImage.
(Haohui Mai via Arpit Agarwal)
BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS
HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9) HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9)

View File

@ -151,7 +151,7 @@
{/fs} {/fs}
</table> </table>
<div class="page-header"><h1>Namenode Journal Status</h1></div> <div class="page-header"><h1>NameNode Journal Status</h1></div>
<p><b>Current transaction ID:</b> {nn.JournalTransactionInfo.LastAppliedOrWrittenTxId}</p> <p><b>Current transaction ID:</b> {nn.JournalTransactionInfo.LastAppliedOrWrittenTxId}</p>
<table class="table" title="NameNode Journals"> <table class="table" title="NameNode Journals">
<thead> <thead>

View File

@ -50,24 +50,23 @@
var data = {}; var data = {};
// Workarounds for the fact that JMXJsonServlet returns non-standard JSON strings // Workarounds for the fact that JMXJsonServlet returns non-standard JSON strings
function data_workaround(d) { function workaround(nn) {
d.nn.JournalTransactionInfo = JSON.parse(d.nn.JournalTransactionInfo); nn.JournalTransactionInfo = JSON.parse(nn.JournalTransactionInfo);
d.nn.NameJournalStatus = JSON.parse(d.nn.NameJournalStatus); nn.NameJournalStatus = JSON.parse(nn.NameJournalStatus);
d.nn.NameDirStatuses = JSON.parse(d.nn.NameDirStatuses); nn.NameDirStatuses = JSON.parse(nn.NameDirStatuses);
d.nn.NodeUsage = JSON.parse(d.nn.NodeUsage); nn.NodeUsage = JSON.parse(nn.NodeUsage);
d.nn.CorruptFiles = JSON.parse(d.nn.CorruptFiles); nn.CorruptFiles = JSON.parse(nn.CorruptFiles);
return d; return nn;
} }
load_json( load_json(
BEANS, BEANS,
function(d) { guard_with_startup_progress(function(d) {
for (var k in d) { for (var k in d) {
data[k] = d[k].beans[0]; data[k] = k === 'nn' ? workaround(d[k].beans[0]) : d[k].beans[0];
} }
data = data_workaround(data);
render(); render();
}, }),
function (url, jqxhr, text, err) { function (url, jqxhr, text, err) {
show_err_msg('<p>Failed to retrieve data from ' + url + ', cause: ' + err + '</p>'); show_err_msg('<p>Failed to retrieve data from ' + url + ', cause: ' + err + '</p>');
}); });
@ -92,6 +91,19 @@
show_err_msg('<p>Failed to retrieve data from ' + url + ', cause: ' + err + '</p>'); show_err_msg('<p>Failed to retrieve data from ' + url + ', cause: ' + err + '</p>');
} }
function guard_with_startup_progress(fn) {
return function() {
try {
fn.apply(this, arguments);
} catch (err) {
if (err instanceof TypeError) {
show_err_msg('NameNode is still loading. Redirecting to the Startup Progress page.');
load_startup_progress();
}
}
};
}
function load_startup_progress() { function load_startup_progress() {
function workaround(r) { function workaround(r) {
function rename_property(o, s, d) { function rename_property(o, s, d) {
@ -143,25 +155,29 @@
return r; return r;
} }
$.get('/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo', function (resp) { $.get(
var data = workaround(resp.beans[0]); '/jmx?qry=Hadoop:service=NameNode,name=NameNodeInfo',
dust.render('datanode-info', data, function(err, out) { guard_with_startup_progress(function (resp) {
$('#tab-datanode').html(out); var data = workaround(resp.beans[0]);
$('#ui-tabs a[href="#tab-datanode"]').tab('show'); dust.render('datanode-info', data, function(err, out) {
}); $('#tab-datanode').html(out);
}).error(ajax_error_handler); $('#ui-tabs a[href="#tab-datanode"]').tab('show');
});
})).error(ajax_error_handler);
} }
$('a[href="#tab-datanode"]').click(load_datanode_info); $('a[href="#tab-datanode"]').click(load_datanode_info);
function load_snapshot_info() { function load_snapshot_info() {
$.get('/jmx?qry=Hadoop:service=NameNode,name=FSNamesystemState', function (resp) { $.get(
var data = JSON.parse(resp.beans[0].SnapshotStats); '/jmx?qry=Hadoop:service=NameNode,name=FSNamesystemState',
dust.render('snapshot-info', data, function(err, out) { guard_with_startup_progress(function (resp) {
$('#tab-snapshot').html(out); var data = JSON.parse(resp.beans[0].SnapshotStats);
$('#ui-tabs a[href="#tab-snapshot"]').tab('show'); dust.render('snapshot-info', data, function(err, out) {
}); $('#tab-snapshot').html(out);
}).error(ajax_error_handler); $('#ui-tabs a[href="#tab-snapshot"]').tab('show');
});
})).error(ajax_error_handler);
} }
$('#ui-tabs a[href="#tab-snapshot"]').click(load_snapshot_info); $('#ui-tabs a[href="#tab-snapshot"]').click(load_snapshot_info);