From 215216abeb657de2d0ac8df52e7af5c4a04ba8cb Mon Sep 17 00:00:00 2001 From: Benoy Antony Date: Tue, 16 Sep 2014 16:24:23 -0700 Subject: [PATCH] HDFS-6799. The invalidate method in SimulatedFSDataset failed to remove (invalidate) blocks from the file system. Contributed by Megasthenis Asteris. --- .../hadoop/hdfs/server/datanode/SimulatedFSDataset.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java index 8ad4510d0d6..d0fad6e2b85 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java @@ -482,9 +482,10 @@ public class SimulatedFSDataset implements FsDatasetSpi { } @Override // FsDatasetSpi - public synchronized void unfinalizeBlock(ExtendedBlock b) { + public synchronized void unfinalizeBlock(ExtendedBlock b) throws IOException{ if (isValidRbw(b)) { - blockMap.remove(b.getLocalBlock()); + final Map map = getMap(b.getBlockPoolId()); + map.remove(b.getLocalBlock()); } } @@ -624,7 +625,7 @@ public class SimulatedFSDataset implements FsDatasetSpi { continue; } storage.free(bpid, binfo.getNumBytes()); - blockMap.remove(b); + map.remove(b); } if (error) { throw new IOException("Invalidate: Missing blocks.");