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/abbcfef6 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/abbcfef6 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/abbcfef6 Branch: refs/heads/HDFS-7285 Commit: abbcfef604890bba1cb28ac5c0a4aa755930e13c Parents: 6e0a319 Author: Zhe Zhang <[email protected]> Authored: Mon Apr 6 10:37:23 2015 -0700 Committer: Zhe Zhang <[email protected]> Committed: Mon Apr 13 10:15:23 2015 -0700 ---------------------------------------------------------------------- .../hadoop/hdfs/server/blockmanagement/BlockManager.java | 11 +++++------ .../apache/hadoop/hdfs/server/namenode/FSNamesystem.java | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/abbcfef6/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 2c3f525..fcf1421 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 @@ -3540,13 +3540,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/abbcfef6/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 9ffb6fc..7c087d0 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 @@ -3133,7 +3133,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, */ LocatedBlock storeAllocatedBlock(String src, long fileId, String clientName, ExtendedBlock previous, DatanodeStorageInfo[] targets) throws IOException { - BlockInfo newBlockInfo = null; + Block newBlock = null; long offset; checkOperation(OperationCategory.WRITE); waitForLoadingFSImage(); @@ -3166,8 +3166,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); @@ -3178,7 +3178,7 @@ public class FSNamesystem implements Namesystem, FSNamesystemMBean, getEditLog().logSync(); // Return located block - return makeLocatedBlock(newBlockInfo, targets, offset); + return makeLocatedBlock(getStoredBlock(newBlock), targets, offset); } /*
