HDFS-5581. NameNodeFsck should use only one instance of BlockPlacementPolicy (vinay via cmccabe)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1547090 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Colin McCabe 2013-12-02 16:36:13 +00:00
parent 0293279c58
commit d3f200bad0
2 changed files with 9 additions and 3 deletions

View File

@ -240,6 +240,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

View File

@ -144,6 +144,8 @@ public class NamenodeFsck {
private final PrintWriter out;
private List<String> 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<String> 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++;