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

Jing Zhao commented on HDFS-7104:
---------------------------------

The logic for INodesInPath containing null elements is actually not introduced 
by snapshot or dot-snapshot dirs. Instead, the null elements are mainly used by 
{{mkdirsRecursively}} to identify directories to create. Thus in this scenario 
the null elements must be retained.

In the meanwhile, the logic of trimming inodes array in {{getINodes}} is only 
used by a snapshot path, since only dot-snapshot path can cause {{capacity < 
inodes.length}}. Thus to move this part into the {{resolve}} function should be 
a good change.

For {{getLastINodeInPath}}, currently in several places we still expect both 
the last inode and the snapshot related information from this method. So the 
return type may still have to be INodeInPath.

> Fix and clarify INodeInPath getter functions
> --------------------------------------------
>
>                 Key: HDFS-7104
>                 URL: https://issues.apache.org/jira/browse/HDFS-7104
>             Project: Hadoop HDFS
>          Issue Type: Bug
>            Reporter: Zhe Zhang
>            Assignee: Zhe Zhang
>            Priority: Minor
>
> inodes is initialized with the number of patch components. After resolve, it 
> contains both non-null and null elements (introduced by dot-snapshot dirs).
> When getINodes is called, an array is returned excluding all non elements, 
> which is the correct behavior. Meanwhile, the inodes array is trimmed too, 
> which shouldn't be done by a getter.
> Because of the above, the behavior of getINodesInPath depends on whether 
> getINodes has been called, which is not correct.
> The name of getLastINodeInPath is confusing – it actually returns the last 
> non-null inode in the path. Also, shouldn't the return type be a single INode?



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

Reply via email to