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

Daryn Sharp commented on HDFS-12614:
------------------------------------

I've not liked the inconsistency with whether the root inode's name is 
considered null or empty string.  However I've been leery to touch it since it 
is a public method and inevitably something somewhere always breaks when 
fixing/changing semantics.

I'd be more comfortable with the change in the call to the attr provider in the 
code you reference above.

I'll take this chance to rant a bit about how enabling an attribute provider 
ruins a lot of the work I put into reducing all the string/byte conversions.  
Those aren't cheap.  The interface is fundamentally flawed: an attr provider 
requires converting each byte[] component of the path back into a string 
multiple times.  Ie. The path {{"/a/b/c"}} requires calling the attr provider 
with: {{""}}, {{"", "a"}},  {{"", "a","b"}}, {{"", "a","b", "c"}}.  Every 
single one of those strings were freshly (re)converted from a byte[].  Bonus 
points if you avoid all the redundant conversions.  I punted on it because at 
the time we had no intention of using the attr provider but now we might.

> FSPermissionChecker#getINodeAttrs() throws NPE when INodeAttributesProvider 
> configured
> --------------------------------------------------------------------------------------
>
>                 Key: HDFS-12614
>                 URL: https://issues.apache.org/jira/browse/HDFS-12614
>             Project: Hadoop HDFS
>          Issue Type: Bug
>    Affects Versions: 3.0.0-beta1
>            Reporter: Manoj Govindassamy
>            Assignee: Manoj Govindassamy
>         Attachments: HDFS-12614.01.patch, HDFS-12614.test.01.patch
>
>
> When INodeAttributesProvider is configured, and when resolving path (like 
> "/") and checking for permission, the following code when working on 
> {{pathByNameArr}} throws NullPointerException. 
> {noformat}
>   private INodeAttributes getINodeAttrs(byte[][] pathByNameArr, int pathIdx,
>       INode inode, int snapshotId) {
>     INodeAttributes inodeAttrs = inode.getSnapshotINode(snapshotId);
>     if (getAttributesProvider() != null) {
>       String[] elements = new String[pathIdx + 1];
>       for (int i = 0; i < elements.length; i++) {
>         elements[i] = DFSUtil.bytes2String(pathByNameArr[i]);  <===
>       }
>       inodeAttrs = getAttributesProvider().getAttributes(elements, 
> inodeAttrs);
>     }
>     return inodeAttrs;
>   }
> {noformat}
> Looks like for paths like "/" where the split components based on delimiter 
> "/" can be null, the pathByNameArr array can have null elements and can throw 
> NPE.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to