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

Akira AJISAKA commented on HDFS-8622:
-------------------------------------

Thank you for updating the patch, [~jagadesh.kiran]. Now I have three comments 
about symlink.
{code:title=FSImageLoader.getContentSummaryMap}
    default:
      return null;
{code}
1. If a path is symlink, webhdfs.getContentSummary(path) fails by NPE. Would 
you set {{data}} appropriately?

{code:title=FSImageLoader.fillDirSummary}
        } else {
          FsImageProto.INodeSection.INodeFile f = node.getFile();
          long curLength = getFileSize(f);
          data[1]++;
          data[2] += curLength;
          data[3] += (curLength) * (f.getReplication());
        }
{code}
2. The above code works well (FYI: Even if the {{node}} is symlink, any 
exception does not occur and only the data\[1\] will be incremented.), but it 
would be better to fix the code for improving readability using switch 
statement as follows:
{code}
  INode node = fromInodeId(cid);
  switch (node.getType()) {
  case DIRECTORY:
    ...
  case FILE:
    ...
  case SYMLINK:
    ...
  default:
    ...
  }
{code}

3. Would you add a test case for symlink?

> Implement GETCONTENTSUMMARY operation for WebImageViewer
> --------------------------------------------------------
>
>                 Key: HDFS-8622
>                 URL: https://issues.apache.org/jira/browse/HDFS-8622
>             Project: Hadoop HDFS
>          Issue Type: New Feature
>            Reporter: Jagadesh Kiran N
>            Assignee: Jagadesh Kiran N
>         Attachments: HDFS-8622-00.patch, HDFS-8622-01.patch, 
> HDFS-8622-02.patch, HDFS-8622-03.patch, HDFS-8622-04.patch
>
>
>  it would be better for administrators if {code} GETCONTENTSUMMARY {code} are 
> supported.



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

Reply via email to