HDFS-2708. Stats for the # of blocks per DN. Contributed by Aaron T. Myers.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1326039 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Aaron Myers 2012-04-14 01:51:03 +00:00
parent 841fdc5628
commit 15fe3ae61b
3 changed files with 5 additions and 0 deletions

View File

@ -377,6 +377,8 @@ Release 2.0.0 - UNRELEASED
HDFS-3259. NameNode#initializeSharedEdits should populate shared edits dir HDFS-3259. NameNode#initializeSharedEdits should populate shared edits dir
with edit log segments. (atm) with edit log segments. (atm)
HDFS-2708. Stats for the # of blocks per DN. (atm)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-3024. Improve performance of stringification in addStoredBlock (todd) HDFS-3024. Improve performance of stringification in addStoredBlock (todd)

View File

@ -5051,6 +5051,7 @@ public class FSNamesystem implements Namesystem, FSClusterStats,
innerinfo.put("adminState", node.getAdminState().toString()); innerinfo.put("adminState", node.getAdminState().toString());
innerinfo.put("nonDfsUsedSpace", node.getNonDfsUsed()); innerinfo.put("nonDfsUsedSpace", node.getNonDfsUsed());
innerinfo.put("capacity", node.getCapacity()); innerinfo.put("capacity", node.getCapacity());
innerinfo.put("numBlocks", node.numBlocks());
info.put(node.getHostName(), innerinfo); info.put(node.getHostName(), innerinfo);
} }
return JSON.toString(info); return JSON.toString(info);

View File

@ -101,6 +101,8 @@ public class TestNameNodeMXBean {
assertTrue(((Long)liveNode.get("nonDfsUsedSpace")) > 0); assertTrue(((Long)liveNode.get("nonDfsUsedSpace")) > 0);
assertTrue(liveNode.containsKey("capacity")); assertTrue(liveNode.containsKey("capacity"));
assertTrue(((Long)liveNode.get("capacity")) > 0); assertTrue(((Long)liveNode.get("capacity")) > 0);
assertTrue(liveNode.containsKey("numBlocks"));
assertTrue(((Long)liveNode.get("numBlocks")) == 0);
} }
Assert.assertEquals(fsn.getLiveNodes(), alivenodeinfo); Assert.assertEquals(fsn.getLiveNodes(), alivenodeinfo);
// get attribute deadnodeinfo // get attribute deadnodeinfo