Browse Source

HDFS-8626. Reserved RBW space is not released if creation of RBW File fails. (Contributed by kanaka kumar avvaru)

Arpit Agarwal 10 years ago
parent
commit
dc4171cb66

+ 3 - 0
hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt

@@ -140,6 +140,9 @@ Release 2.7.1 - UNRELEASED
     HDFS-8633. Fix setting of dfs.datanode.readahead.bytes in hdfs-default.xml
     to match DFSConfigKeys. (Ray Chiang via Yongjun Zhang)
 
+    HDFS-8626. Reserved RBW space is not released if creation of RBW File
+    fails. (kanaka kumar avvaru via Arpit Agarwal)
+
 Release 2.7.0 - 2015-04-20
 
   INCOMPATIBLE CHANGES

+ 6 - 1
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java

@@ -759,7 +759,12 @@ public class FsVolumeImpl implements FsVolumeSpi {
   File createRbwFile(String bpid, Block b) throws IOException {
     checkReference();
     reserveSpaceForRbw(b.getNumBytes());
-    return getBlockPoolSlice(bpid).createRbwFile(b);
+    try {
+      return getBlockPoolSlice(bpid).createRbwFile(b);
+    } catch (IOException exception) {
+      releaseReservedSpace(b.getNumBytes());
+      throw exception;
+    }
   }
 
   /**