[ 
https://issues.apache.org/jira/browse/HDFS-4229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Brock Noland updated HDFS-4229:
-------------------------------

    Attachment: HDFS-4229-0.patch.txt

The patch attached changes the DU class in common. I think making the change 
their is appropriate because a drive should never have a negative amount 
"used". Should I create a HADOOP jira for this? I wasn't able to detect based 
on (http://wiki.apache.org/hadoop/HowToContribute)


Details on the change:

The change to the DU class simply wraps the getUsed() return statement in a 
Math.max(used, 0L) to ensure that the getUsed method never returns negative. 

Another option would be when getUsed() would return negative to re-run the DU 
command. I do not feel that change is appropriate because there are still races 
mean we would have to loop until we obtain a positive value. The scenario where 
getUsed() can return negative occurs when there is a very small, possibly zero, 
amount actually used. As such reporting a perfectly correct number is of little 
value.
                
> HDFS can report negative DFS Used on clusters with very small amounts of data
> -----------------------------------------------------------------------------
>
>                 Key: HDFS-4229
>                 URL: https://issues.apache.org/jira/browse/HDFS-4229
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 2.0.2-alpha
>            Reporter: Brock Noland
>            Priority: Minor
>         Attachments: HDFS-4229-0.patch.txt
>
>
> I had a near empty HDFS instance where I was creating a file and deleting it 
> very quickly. I noticed that HDFS sometimes reported a negative DFS used.
> {noformat}
> root@brock0-1 ~]# sudo -u hdfs -i hdfs dfsadmin -report
> Configured Capacity: 97233235968 (90.56 GB)
> Present Capacity: 84289609707 (78.5 GB)
> DFS Remaining: 84426645504 (78.63 GB)
> DFS Used: -137035797 (-133824.02 KB)
> DFS Used%: -0.16%
> Under replicated blocks: 0
> Blocks with corrupt replicas: 0
> Missing blocks: 0
> -------------------------------------------------
> Datanodes available: 1 (1 total, 0 dead)
> Live datanodes:
> Name: 127.0.0.1:50010 (localhost)
> Hostname: brock0-1.ent.cloudera.com
> Decommission Status : Normal
> Configured Capacity: 97233235968 (90.56 GB)
> DFS Used: -137035797 (-133824.02 KB)
> Non DFS Used: 12943626261 (12.05 GB)
> DFS Remaining: 84426645504 (78.63 GB)
> DFS Used%: -0.14%
> DFS Remaining%: 86.83%
> Last contact: Thu Nov 22 18:25:37 PST 2012
> [root@brock0-1 ~]# sudo -u hdfs -i hdfs dfsadmin -report
> Configured Capacity: 97233235968 (90.56 GB)
> Present Capacity: 84426973184 (78.63 GB)
> DFS Remaining: 84426629120 (78.63 GB)
> DFS Used: 344064 (336 KB)
> DFS Used%: 0%
> Under replicated blocks: 0
> Blocks with corrupt replicas: 0
> Missing blocks: 0
> -------------------------------------------------
> Datanodes available: 1 (1 total, 0 dead)
> Live datanodes:
> Name: 127.0.0.1:50010 (localhost)
> Hostname: brock0-1.ent.cloudera.com
> Decommission Status : Normal
> Configured Capacity: 97233235968 (90.56 GB)
> DFS Used: 344064 (336 KB)
> Non DFS Used: 12806262784 (11.93 GB)
> DFS Remaining: 84426629120 (78.63 GB)
> DFS Used%: 0%
> DFS Remaining%: 86.83%
> Last contact: Thu Nov 22 18:28:47 PST 2012
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to