From ea2e60fbcc79c65ec571224bd3f57c262a5d9114 Mon Sep 17 00:00:00 2001 From: Zhe Zhang Date: Tue, 24 Mar 2015 11:39:36 -0700 Subject: [PATCH] HDFS-7936. Erasure coding: resolving conflicts when merging with HDFS-7903, HDFS-7435, HDFS-7930, HDFS-7960 (this commit is for HDFS-7960) --- .../hadoop/hdfs/server/blockmanagement/BlockManager.java | 4 ++-- .../blockmanagement/TestNameNodePrunesMissingStorages.java | 5 ++++- .../hadoop/hdfs/server/namenode/TestAddStripedBlocks.java | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) 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 079d218877f..363e687a368 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 @@ -1996,10 +1996,10 @@ public class BlockManager { "longer exists on the DataNode.", Long.toHexString(context.getReportId()), zombie.getStorageID()); assert(namesystem.hasWriteLock()); - Iterator iter = zombie.getBlockIterator(); + Iterator iter = zombie.getBlockIterator(); int prevBlocks = zombie.numBlocks(); while (iter.hasNext()) { - BlockInfoContiguous block = iter.next(); + BlockInfo block = iter.next(); // We assume that a block can be on only one storage in a DataNode. // That's why we pass in the DatanodeDescriptor rather than the // DatanodeStorageInfo. diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestNameNodePrunesMissingStorages.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestNameNodePrunesMissingStorages.java index d73f63e7386..58c1717c31a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestNameNodePrunesMissingStorages.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/blockmanagement/TestNameNodePrunesMissingStorages.java @@ -185,9 +185,12 @@ public class TestNameNodePrunesMissingStorages { String datanodeUuid; // Find the first storage which this block is in. try { + BlockInfo storedBlock = + cluster.getNamesystem().getBlockManager(). + getStoredBlock(block.getLocalBlock()); Iterator storageInfoIter = cluster.getNamesystem().getBlockManager(). - getStorages(block.getLocalBlock()).iterator(); + blocksMap.getStorages(storedBlock).iterator(); assertTrue(storageInfoIter.hasNext()); DatanodeStorageInfo info = storageInfoIter.next(); storageIdToRemove = info.getStorageID(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAddStripedBlocks.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAddStripedBlocks.java index 05aec4be95b..7d7c81e0fe4 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAddStripedBlocks.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestAddStripedBlocks.java @@ -269,7 +269,7 @@ public class TestAddStripedBlocks { StorageBlockReport[] reports = {new StorageBlockReport(storage, bll)}; cluster.getNameNodeRpc().blockReport(dn.getDNRegistrationForBP(bpId), - bpId, reports); + bpId, reports, null); } BlockInfoStripedUnderConstruction ucBlock =