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

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1547088 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Colin McCabe 2013-12-02 16:31:03 +00:00
parent 7b60e94c09
commit 13331a6863
2 changed files with 9 additions and 3 deletions

View File

@ -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

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 @@ void check(String parent, HdfsFileStatus file, Result res) throws IOException {
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++;