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

Vinayakumar B commented on HDFS-8545:
-------------------------------------

On a second thought, 
along with new overloaded API, how about refactoring current {{getUsed()}} also 
to get the usage from the contentsummary than iterating through the list of 
files recursively. 
{code}  /** Return the total size of all files in the filesystem.*/
  public long getUsed() throws IOException{
    Path path = new Path("/");
    return getContentSummary(path).getLength();
  }{code}
This would improve the performance as well.

[~wheat9], what do you say?

> Add an API to fetch the total file length from a specific path, apart from 
> getting by default from root
> -------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-8545
>                 URL: https://issues.apache.org/jira/browse/HDFS-8545
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: J.Andreina
>            Assignee: J.Andreina
>            Priority: Minor
>         Attachments: HDFS-8545.1.patch, HDFS-8545.2.patch, HDFS-8545.3.patch, 
> HDFS-8545.4.patch
>
>
> Currently by default in FileSystem#getUsed() returns the total file size from 
> root. 
> It is good to have an api to return the total file size from specified path 
> ,same as we specify the path in "./hdfs dfs -du -s /path" .



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to