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

Haohui Mai commented on HDFS-5956:
----------------------------------

The patch mostly looks good. Some minor comments:

{code}
+    long maxFileSize = 0;
+    for (FileStatus fs : writtenFiles.values()) {
+      maxFileSize = Math.max(maxFileSize, fs.getLen());
+    }
{code}

You can use {{Collections.max}} instead.

nit: can you change the name of the test (i.e., 
{{testFileDistributionVisitor}}) in this patch as well?

> A file size is multiplied by the replication factor in 'hdfs oiv -p 
> FileDistribution' option
> --------------------------------------------------------------------------------------------
>
>                 Key: HDFS-5956
>                 URL: https://issues.apache.org/jira/browse/HDFS-5956
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: tools
>    Affects Versions: 3.0.0
>            Reporter: Akira AJISAKA
>            Assignee: Akira AJISAKA
>              Labels: newbie
>         Attachments: HDFS-5956.patch
>
>
> In FileDistributionCalculator.java, 
> {code}
>         long fileSize = 0;
>         for (BlockProto b : f.getBlocksList()) {
>           fileSize += b.getNumBytes() * f.getReplication();
>         }
>         maxFileSize = Math.max(fileSize, maxFileSize);
>         totalSpace += fileSize;
> {code}
> should be
> {code}
>         long fileSize = 0;
>         for (BlockProto b : f.getBlocksList()) {
>           fileSize += b.getNumBytes();
>         }
>         maxFileSize = Math.max(fileSize, maxFileSize);
>         totalSpace += fileSize * f.getReplication();
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Reply via email to