diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt index 78ca6d34fa..0ed61cd445 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-EC-7285.txt @@ -85,3 +85,5 @@ HDFS-7994. Detect if resevered EC Block ID is already used during namenode startup. (Hui Zheng via szetszwo) + + HDFS-8167. BlockManager.addBlockCollectionWithCheck should check if the block is a striped block. (Hui Zheng via zhz). 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 e149f24b32..00ee0a7349 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 @@ -2946,15 +2946,6 @@ public boolean hasNonEcBlockUsingStripedID(){ return hasNonEcBlockUsingStripedID; } - /** - * Set the value of whether there are any non-EC blocks using StripedID. - * - * @param has - the value of whether there are any non-EC blocks using StripedID. - */ - public void hasNonEcBlockUsingStripedID(boolean has){ - hasNonEcBlockUsingStripedID = has; - } - /** * Process a single possibly misreplicated block. This adds it to the * appropriate queues if necessary, and returns a result code indicating @@ -3562,7 +3553,7 @@ public BlockInfo getStoredBlock(Block block) { if (BlockIdManager.isStripedBlockID(block.getBlockId())) { info = blocksMap.getStoredBlock( new Block(BlockIdManager.convertToStripedID(block.getBlockId()))); - if ((info == null) && hasNonEcBlockUsingStripedID()){ + if ((info == null) && hasNonEcBlockUsingStripedID){ info = blocksMap.getStoredBlock(block); } } else { @@ -3746,10 +3737,9 @@ public BlockInfo addBlockCollection(BlockInfo block, */ public BlockInfo addBlockCollectionWithCheck( BlockInfo block, BlockCollection bc) { - if (!hasNonEcBlockUsingStripedID()){ - if (BlockIdManager.isStripedBlockID(block.getBlockId())) { - hasNonEcBlockUsingStripedID(true); - } + if (!hasNonEcBlockUsingStripedID && !block.isStriped() && + BlockIdManager.isStripedBlockID(block.getBlockId())) { + hasNonEcBlockUsingStripedID = true; } return addBlockCollection(block, bc); }