Skip to content

Commit

Permalink
HDFS-5215. dfs.datanode.du.reserved is not considered while computing
Browse files Browse the repository at this point in the history
available space ( Brahma Reddy Battula via Yongjun Zhang)
  • Loading branch information
Yongjun Zhang committed Apr 8, 2015
1 parent 5449adc commit 66763bb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
3 changes: 3 additions & 0 deletions hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,9 @@ Release 2.8.0 - UNRELEASED
HDFS-7916. 'reportBadBlocks' from datanodes to standby Node BPServiceActor
goes for infinite loop (vinayakumarb)

HDFS-5215. dfs.datanode.du.reserved is not considered while computing
available space ( Brahma Reddy Battula via Yongjun Zhang)

Release 2.7.0 - UNRELEASED

INCOMPATIBLE CHANGES
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2494,9 +2494,9 @@ public synchronized void shutdownBlockPool(String bpid) {
*/
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,9 +305,11 @@ long getBlockPoolUsed(String bpid) throws IOException {
}

/**
* 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() {
Expand All @@ -329,10 +331,16 @@ public void setCapacityForTesting(long capacity) {
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;
}
Expand Down

0 comments on commit 66763bb

Please sign in to comment.