[
https://issues.apache.org/jira/browse/HDFS-13233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16387342#comment-16387342
]
wangzhiyuan edited comment on HDFS-13233 at 3/6/18 6:12 AM:
------------------------------------------------------------
[~elgoiri] New patch has been uploaded.
Actually I think below function is OK:
```java
private boolean isParentEntry(final String path, final String parent) { if
(!path.startsWith(parent))
{ return false; }
if (path.equals(parent))
{ return true; }
return path.charAt(parent.length()) == '/';
}
```
path.startsWith(parent) could guarantee path.length() >= parent.length()
!path.equals(parent) could guarantee path.length() != parent.length()
So path.charAt(parent.length()) is safe here.
was (Author: striver.wang):
[~elgoiri] New patch has been uploaded.
Actually I think below function is OK:
private boolean isParentEntry(final String path, final String parent) { if
(!path.startsWith(parent)) { return false;
} if (path.equals(parent)) { return true;
} return path.charAt(parent.length()) == '/';
}
path.startsWith(parent) could guarantee path.length() >= parent.length()
!path.equals(parent) could guarantee path.length() != parent.length()
So path.charAt(parent.length()) is safe here.
> RBF:getMountPoint doesn't return the correct mount point of the mount table
> ---------------------------------------------------------------------------
>
> Key: HDFS-13233
> URL: https://issues.apache.org/jira/browse/HDFS-13233
> Project: Hadoop HDFS
> Issue Type: Bug
> Components: hdfs
> Affects Versions: 3.2.0
> Reporter: wangzhiyuan
> Priority: Major
> Attachments: HDFS-13233.001.patch, HDFS-13233.002.patch
>
>
> Method MountTableResolver->getMountPoint will traverse mount table and return
> the first mount point which the input path starts with, but the condition is
> not sufficient.
> Suppose the mount point table contains: "/user" "/user/test" "/user/test1",
> if the input path is "/user/test111", the return mount point is
> "/user/test1", but the correct one should be "/user".
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]