maobaolong created HDFS-11752:
---------------------------------

             Summary: getNonDfsUsed return 0 if reserved bigger than 
actualNonDfsUsed
                 Key: HDFS-11752
                 URL: https://issues.apache.org/jira/browse/HDFS-11752
             Project: Hadoop HDFS
          Issue Type: Bug
          Components: datanode, hdfs
    Affects Versions: 2.7.1
            Reporter: maobaolong
             Fix For: 2.7.1


{code}
public long getNonDfsUsed() throws IOException {
    long actualNonDfsUsed = getActualNonDfsUsed();
    if (actualNonDfsUsed < reserved) {
      return 0L;
    }
    return actualNonDfsUsed - reserved;
  }
{code}

The code block above is the function to caculate nonDfsUsed, but in fact it 
will let the result to be 0L out of expect. Such as this following situation:

du.reserved  = 50G
Disk Capacity = 2048G
Disk Available = 2000G
Dfs used = 30G

usage.getUsed() = dirFile.getTotalSpace() - dirFile.getFreeSpace()
                            = 2048G - 2000G
                            = 48G
getActualNonDfsUsed  =  usage.getUsed() - getDfsUsed()
                                      =  48G - 30G
                                      = 18G
18G < 50G, so the function `getNonDfsUsed` actualNonDfsUsed < reserved, and the 
NonDfsUsed will return 0, is that logic make sense?



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to