From 96f9fc91993b04166f30fdf2dc5145ac91dbf1df Mon Sep 17 00:00:00 2001 From: Tsz-wo Sze Date: Wed, 28 Sep 2011 05:49:17 +0000 Subject: [PATCH] HDFS-2363. Move datanodes size printing from FSNamesystem.metasave(..) to BlockManager. Contributed by Uma Maheswara Rao G git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1176733 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/server/blockmanagement/BlockManager.java | 5 +++++ .../org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 5 ----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index c6a78355aa..4a37a36de8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -765,6 +765,9 @@ Release 0.23.0 - Unreleased HDFS-2332. Add test for HADOOP-7629 (using an immutable FsPermission object as an RPC parameter fails). (todd) + HDFS-2363. Move datanodes size printing from FSNamesystem.metasave(..) + to BlockManager. (Uma Maheswara Rao G via szetszwo) + OPTIMIZATIONS HDFS-1458. Improve checkpoint performance by avoiding unnecessary image diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java index 402e95c3cc..994275aec0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java @@ -308,6 +308,11 @@ public void setBlockPlacementPolicy(BlockPlacementPolicy newpolicy) { /** Dump meta data to out. */ public void metaSave(PrintWriter out) { assert namesystem.hasWriteLock(); + final List live = new ArrayList(); + final List dead = new ArrayList(); + datanodeManager.fetchDatanodes(live, dead, false); + out.println("Live Datanodes: " + live.size()); + out.println("Dead Datanodes: " + dead.size()); // // Dump contents of neededReplication // diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java index 116fa4826a..4851796cea 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java @@ -564,11 +564,6 @@ void metaSave(String filename) throws IOException { out.println(totalInodes + " files and directories, " + totalBlocks + " blocks = " + (totalInodes + totalBlocks) + " total"); - final List live = new ArrayList(); - final List dead = new ArrayList(); - blockManager.getDatanodeManager().fetchDatanodes(live, dead, false); - out.println("Live Datanodes: "+live.size()); - out.println("Dead Datanodes: "+dead.size()); blockManager.metaSave(out); out.flush();