HDFS-7936. Erasure coding: resolving conflicts in the branch when merging trunk changes (this commit is for HDFS-8035). Contributed by Zhe Zhang
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e6ecbaaf Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e6ecbaaf Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e6ecbaaf Branch: refs/heads/HDFS-7285 Commit: e6ecbaafd940824bd0c9d0f20b524d70f7455c1c Parents: bdb67d9 Author: Zhe Zhang <z...@apache.org> Authored: Mon Apr 6 10:37:23 2015 -0700 Committer: Zhe Zhang <z...@apache.org> Committed: Mon Apr 6 10:37:23 2015 -0700 ---------------------------------------------------------------------- .../hadoop/hdfs/server/blockmanagement/BlockManager.java | 11 +++++------ .../apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 10 +++++----- 2 files changed, 10 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/e6ecbaaf/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java ---------------------------------------------------------------------- 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 bce789a..d30e623 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 @@ -3529,13 +3529,12 @@ public class BlockManager { String src, BlockInfo[] blocks) { for (BlockInfo b: blocks) { if (!b.isComplete()) { - final BlockInfoContiguousUnderConstruction uc = - (BlockInfoContiguousUnderConstruction)b; final int numNodes = b.numNodes(); - LOG.info("BLOCK* " + b + " is not COMPLETE (ucState = " - + uc.getBlockUCState() + ", replication# = " + numNodes - + (numNodes < minReplication ? " < ": " >= ") - + " minimum = " + minReplication + ") in file " + src); + final int min = getMinStorageNum(b); + final BlockUCState state = b.getBlockUCState(); + LOG.info("BLOCK* " + b + " is not COMPLETE (ucState = " + state + + ", replication# = " + numNodes + (numNodes < min ? " < " : " >= ") + + " minimum = " + min + ") in file " + src); return false; } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/e6ecbaaf/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java ---------------------------------------------------------------------- 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 6fb258a..009e5a8 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 @@ -3100,7 +3100,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, // Part II. // Allocate a new block, add it to the INode and the BlocksMap. - BlockInfo newBlockInfo = null; + Block newBlock = null; long offset; checkOperation(OperationCategory.WRITE); waitForLoadingFSImage(); @@ -3133,8 +3133,8 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, ExtendedBlock.getLocalBlock(previous)); // allocate new block, record block locations in INode. - Block newBlock = createNewBlock(isStriped); - newBlockInfo = saveAllocatedBlock(src, fileState.iip, newBlock, targets, + newBlock = createNewBlock(isStriped); + saveAllocatedBlock(src, fileState.iip, newBlock, targets, isStriped); persistNewBlock(src, pendingFile); @@ -3145,7 +3145,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, getEditLog().logSync(); // Return located block - return makeLocatedBlock(newBlockInfo, targets, offset); + return makeLocatedBlock(getStoredBlock(newBlock), targets, offset); } /* @@ -3602,7 +3602,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, BlockInfo b = v.getPenultimateBlock(); return b == null || blockManager.checkBlocksProperlyReplicated( - src, new BlockInfoContiguous[] { b }); + src, new BlockInfo[] { b }); } } finally { readUnlock();