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

Yiqun Lin edited comment on HDFS-13226 at 3/8/18 2:25 AM:
----------------------------------------------------------

Just looking into the v004 patch. I don't think it's a appropriate way to throw 
exception in {{validate}} method. After that, the returned value must be 
{{true}} or exception. Actually here we just want to check the error type. One 
way we can add new test specified for {{MountTable#validate}}. You may create 
this test in {{TestMountTable}}. Current test is also needed.

In additional, following check seems not enough:
{code}
+    if (!this.getSourcePath().startsWith("/")
+        || this.getSourcePath().startsWith("//")) {
+      throw new IllegalArgumentException("Invalid entry, all mount points must 
start with a single / ");
     }
{code}
We may need a more strict valid path checking in constructing new mount table. 
Additionally check the case of {{//}} is one of the invalid case.  We can 
complete this in another JIRA.


was (Author: linyiqun):
Just looking into the v004 patch. I don't think it's a appropriate way to throw 
exception in {{validate}} method. After that, the returned value must be 
{{true}} or exception. Actually here we just want to check the error type. One 
way we can add new test specified for {{MountTable#validate}}. You may create 
this test in {{TestMountTable}}.

In additional, following check seems not enough:
{code}
+    if (!this.getSourcePath().startsWith("/")
+        || this.getSourcePath().startsWith("//")) {
+      throw new IllegalArgumentException("Invalid entry, all mount points must 
start with a single / ");
     }
{code}
We may need a more strict valid path checking in constructing new mount table. 
Additionally check the case of {{//}} is one of the invalid case.  We can 
complete this in another JIRA.

> RBF: We should throw the failure validate and refuse this mount entry
> ---------------------------------------------------------------------
>
>                 Key: HDFS-13226
>                 URL: https://issues.apache.org/jira/browse/HDFS-13226
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: hdfs
>    Affects Versions: 3.2.0
>            Reporter: maobaolong
>            Assignee: maobaolong
>            Priority: Major
>              Labels: RBF
>             Fix For: 3.2.0
>
>         Attachments: HDFS-13226.001.patch, HDFS-13226.002.patch, 
> HDFS-13226.003.patch, HDFS-13226.004.patch
>
>
> one of the mount entry source path rule is that the source path must start 
> with '\', somebody didn't follow the rule and execute the following command:
> {code:bash}
> $ hdfs dfsrouteradmin -add addnode/ ns1 /addnode/
> {code}
> But, the console show we are successful add this entry.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
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