diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 224d14bb9f8..ed234e6d400 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -90,6 +90,10 @@ Release 2.7.1 - UNRELEASED HDFS-8451. DFSClient probe for encryption testing interprets empty URI property for "enabled". (Steve Loughran via xyao) + HDFS-5215. dfs.datanode.du.reserved is not considered while computing + available space ( Brahma Reddy Battula via Yongjun Zhang) + + Release 2.7.0 - 2015-04-20 INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java index d236d4516b3..1a3fd5bf713 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java @@ -2491,9 +2491,9 @@ class FsDatasetImpl implements FsDatasetSpi { */ private static class VolumeInfo { final String directory; - final long usedSpace; - final long freeSpace; - final long reservedSpace; + final long usedSpace; // size of space used by HDFS + final long freeSpace; // size of free space excluding reserved space + final long reservedSpace; // size of space reserved for non-HDFS and RBW VolumeInfo(FsVolumeImpl v, long usedSpace, long freeSpace) { this.directory = v.toString(); diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java index cd60e0728e1..eee3373d24a 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsVolumeImpl.java @@ -305,9 +305,11 @@ public class FsVolumeImpl implements FsVolumeSpi { } /** - * Calculate the capacity of the filesystem, after removing any - * reserved capacity. - * @return the unreserved number of bytes left in this filesystem. May be zero. + * Return either the configured capacity of the file system if configured; or + * the capacity of the file system excluding space reserved for non-HDFS. + * + * @return the unreserved number of bytes left in this filesystem. May be + * zero. */ @VisibleForTesting public long getCapacity() { @@ -329,10 +331,16 @@ public class FsVolumeImpl implements FsVolumeSpi { this.configuredCapacity = capacity; } + /* + * Calculate the available space of the filesystem, excluding space reserved + * for non-HDFS and space reserved for RBW + * + * @return the available number of bytes left in this filesystem. May be zero. + */ @Override public long getAvailable() throws IOException { long remaining = getCapacity() - getDfsUsed() - reservedForRbw.get(); - long available = usage.getAvailable(); + long available = usage.getAvailable() - reserved - reservedForRbw.get(); if (remaining > available) { remaining = available; }