HDFS-15013. Reduce NameNode overview tab response time. Contributed by HuangTao.

This commit is contained in:
Surendra Singh Lilhore 2019-11-29 00:42:31 +05:30
parent 0384687811
commit 44f7b9159d
1 changed files with 15 additions and 2 deletions

View File

@ -65,8 +65,9 @@
}; };
var data = {}; var data = {};
var non_ha = false;
$.ajax({'url': '/conf', 'dataType': 'xml', 'async': false}).done( $.ajax({'url': '/conf', 'dataType': 'xml', 'async': true}).done(
function(d) { function(d) {
var $xml = $(d); var $xml = $(d);
var namespace, nnId; var namespace, nnId;
@ -80,6 +81,8 @@
}); });
if (namespace && nnId) { if (namespace && nnId) {
data['HAInfo'] = {"Namespace": namespace, "NamenodeID": nnId}; data['HAInfo'] = {"Namespace": namespace, "NamenodeID": nnId};
} else {
non_ha = true;
} }
}); });
@ -109,7 +112,17 @@
data.fs.ObjectsTotal = data.fs.FilesTotal + data.fs.BlocksTotal; data.fs.ObjectsTotal = data.fs.FilesTotal + data.fs.BlocksTotal;
render(); var wait_for_conf = setInterval(function() {
if (non_ha ||
(('HAInfo' in data) &&
("Namespace" in data['HAInfo']) &&
("NamenodeID" in data['HAInfo'])
)
) {
render();
clearInterval(wait_for_conf);
}
}, 5);
}), }),
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>');