diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 10027631333..07f7d72f369 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -664,6 +664,9 @@ Release 2.2.1 - UNRELEASED HDFS-5568. Support includeSnapshots option with Fsck command. (Vinayakumar B via umamahesh) + HDFS-5581. NameNodeFsck should use only one instance of + BlockPlacementPolicy. (vinay via cmccabe) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java index 7ed77585853..dfd01b5c39b 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NamenodeFsck.java @@ -144,6 +144,8 @@ public class NamenodeFsck { private final PrintWriter out; private List snapshottableDirs = null; + private BlockPlacementPolicy bpPolicy; + /** * Filesystem checker. * @param conf configuration (namenode config) @@ -166,6 +168,8 @@ public class NamenodeFsck { this.totalDatanodes = totalDatanodes; this.minReplication = minReplication; this.remoteAddress = remoteAddress; + this.bpPolicy = BlockPlacementPolicy.getInstance(conf, null, + networktopology); for (Iterator it = pmap.keySet().iterator(); it.hasNext();) { String key = it.next(); @@ -399,9 +403,8 @@ public class NamenodeFsck { locs.length + " replica(s)."); } // verify block placement policy - BlockPlacementStatus blockPlacementStatus = - BlockPlacementPolicy.getInstance(conf, null, networktopology). - verifyBlockPlacement(path, lBlk, targetFileReplication); + BlockPlacementStatus blockPlacementStatus = bpPolicy + .verifyBlockPlacement(path, lBlk, targetFileReplication); if (!blockPlacementStatus.isPlacementPolicySatisfied()) { res.numMisReplicatedBlocks++; misReplicatedPerFile++;