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

Nathan Roberts commented on HDFS-11752:
---------------------------------------

I think this is intentional. My understanding is that nonDFSUsed is supposed to 
be the amount of HDFS space that is consumed by non HDFS entities. Since the 
Reserved space is not available to HDFS, nonDFSUsed shouldn't include any usage 
covered by the reservation. 

Are you seeing issues in 2.7 or 3.0 because there have been fixes in 2.8 and 
3.0 which change some of the calculations in this area? 2.7 definitely had 
problems where it was not correctly calculating the amount of remaining space. 
The 2.8 calculations seem correct (I didn't try 3.0 but as long as nothing 
regressed it should be ok as well). 

> 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
>              Labels: datanode, hdfs
>             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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to