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

Vinayakumar B commented on HDFS-8815:
-------------------------------------

Hi [~surendrasingh], thanks for taking this up. 
Here are some comments.

1. I think there is a need to implement any one of the proposed options. Patch 
seems to have both.
Since {{getStoragePolicy(path)}} directly get the {{BlockStoragePolicy}} lets 
NOT cache the policy suite for now.

2. {{FSDirAttrOp#getStoragePolicy(..)}}, need not be {{public}}.

3. in {{FSDirAttrOp#getStoragePolicy(..)}}, after the line {{byte[][] 
pathComponents = FSDirectory.getPathComponentsForReservedPath(path);}}, entire 
thing should be inside {{fsd.readlock()}}.

4. instead of below code
  {code}for (BlockStoragePolicy policy : bm.getStoragePolicies()) {
     byte storagePolicyId = inode.getStoragePolicyID();
      if (policy.getId() == storagePolicyId) {
        return policy;
      }
    }
    return null;{code}
    can use one line, {code}return 
bm.getStoragePolicy(inode.getStoragePolicyID());{code}

5. {{DFSClient#getStoragePolicy}} javadoc, put @param above @return.



[~arpitagarwal], Do you have any thoughts here?

> DFS getStoragePolicy implementation using single RPC call
> ---------------------------------------------------------
>
>                 Key: HDFS-8815
>                 URL: https://issues.apache.org/jira/browse/HDFS-8815
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: hdfs-client
>    Affects Versions: 2.8.0
>            Reporter: Arpit Agarwal
>            Assignee: Surendra Singh Lilhore
>         Attachments: HDFS-8815-001.patch, HDFS-8815-002.patch
>
>
> HADOOP-12161 introduced a new {{FileSystem#getStoragePolicy}} call. The DFS 
> implementation of the call requires two RPC calls, the first to fetch the 
> storage policy ID and the second to fetch the policy suite to map the policy 
> ID to a {{BlockStoragePolicySpi}}.
> Fix the implementation to require a single RPC call.



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

Reply via email to