[ 
https://issues.apache.org/jira/browse/HDFS-5215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13809448#comment-13809448
 ] 

Suresh Srinivas commented on HDFS-5215:
---------------------------------------

Here is the branch-2 code:
{code}
  /**
   * Calculate the capacity of the filesystem, after removing any
   * reserved capacity.
   * @return the unreserved number of bytes left in this filesystem. May be 
zero.
   */
  long getCapacity() {
    long remaining = usage.getCapacity() - reserved;
    return remaining > 0 ? remaining : 0;
  }

  @Override
  public long getAvailable() throws IOException {
    long remaining = getCapacity()-getDfsUsed();
    long available = usage.getAvailable();
    if (remaining > available) {
      remaining = available;
    }
    return (remaining > 0) ? remaining : 0;
  }
{code}

The logic seems to be correct.
* {{remaining}} is total capacity - reserved - dfs used. That is the space 
available for DFS use without considering actual space available on the disk.
* {{available}} is space currently available.

The remaining space returned is smaller of the above two. This seems correct to 
me. What is the need to remove reserved space from available above?

> dfs.datanode.du.reserved is not taking effect as it's not considered while 
> getting the available space
> ------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-5215
>                 URL: https://issues.apache.org/jira/browse/HDFS-5215
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: datanode
>    Affects Versions: 3.0.0
>            Reporter: Brahma Reddy Battula
>            Assignee: Brahma Reddy Battula
>             Fix For: 3.0.0
>
>         Attachments: HDFS-5215.patch
>
>
> {code}public long getAvailable() throws IOException {
>     long remaining = getCapacity()-getDfsUsed();
>     long available = usage.getAvailable();
>     if (remaining > available) {
>       remaining = available;
>     }
>     return (remaining > 0) ? remaining : 0;
>   } 
> {code}
> Here we are not considering the reserved space while getting the Available 
> Space.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to