HDFS-3158. LiveNodes member of NameNodeMXBean should list non-DFS used space and capacity per DN. Contributed by Aaron T. Myers.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1306637 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Aaron Myers 2012-03-28 23:02:19 +00:00
parent b29fbb0855
commit 979839eb2b
3 changed files with 14 additions and 0 deletions

View File

@ -177,6 +177,9 @@ Release 2.0.0 - UNRELEASED
HDFS-3155. Clean up FSDataset implemenation related code. (szetszwo)
HDFS-3158. LiveNodes member of NameNodeMXBean should list non-DFS used
space and capacity per DN. (atm)
OPTIMIZATIONS
HDFS-2477. Optimize computing the diff between a block report and the

View File

@ -5070,6 +5070,8 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
innerinfo.put("lastContact", getLastContact(node));
innerinfo.put("usedSpace", getDfsUsed(node));
innerinfo.put("adminState", node.getAdminState().toString());
innerinfo.put("nonDfsUsedSpace", node.getNonDfsUsed());
innerinfo.put("capacity", node.getCapacity());
info.put(node.getHostName(), innerinfo);
}
return JSON.toString(info);

View File

@ -93,6 +93,15 @@ public class TestNameNodeMXBean {
// get attribute alivenodeinfo
String alivenodeinfo = (String) (mbs.getAttribute(mxbeanName,
"LiveNodes"));
Map<String, Map<String, Object>> liveNodes =
(Map<String, Map<String, Object>>) JSON.parse(alivenodeinfo);
assertTrue(liveNodes.size() > 0);
for (Map<String, Object> liveNode : liveNodes.values()) {
assertTrue(liveNode.containsKey("nonDfsUsedSpace"));
assertTrue(((Long)liveNode.get("nonDfsUsedSpace")) > 0);
assertTrue(liveNode.containsKey("capacity"));
assertTrue(((Long)liveNode.get("capacity")) > 0);
}
Assert.assertEquals(fsn.getLiveNodes(), alivenodeinfo);
// get attribute deadnodeinfo
String deadnodeinfo = (String) (mbs.getAttribute(mxbeanName,