-
Notifications
You must be signed in to change notification settings - Fork 8.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HDFS-16503. Should verify whether the path name is valid in the WebHDFS #4067
Conversation
🎊 +1 overall
This message was automatically generated. |
Hi @tasanuma @ayushtkn @Hexiaoqiao , could you please take a look? Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a cursory look and it makes sense to me.
@Test | ||
public void testWebHdfsCreateWithInvalidPath() throws Exception { | ||
final Configuration conf = WebHdfsTestUtil.createConf(); | ||
cluster = new MiniDFSCluster.Builder(conf).numDataNodes(1).build(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need a datanode, if you aren't writing any data, you can survive with 0 datanodes as well?
btw if not, the default is 1 only, you don't need to explicitly put one there. IIRC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you need a datanode, if you aren't writing any data, you can survive with 0 datanodes as well? btw if not, the default is 1 only, you don't need to explicitly put one there. IIRC
Thanks you @ayushtkn very much for the review. I fixed it.
🎊 +1 overall
This message was automatically generated. |
@@ -478,7 +478,7 @@ private Path makeAbsolute(Path f) { | |||
return f.isAbsolute()? f: new Path(workingDir, f); | |||
} | |||
|
|||
static Map<?, ?> jsonParse(final HttpURLConnection c, | |||
public static Map<?, ?> jsonParse(final HttpURLConnection c, | |||
final boolean useErrorStream) throws IOException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it made public only for test?
If so please add VisibleForTesting Annotation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Thanks for your review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Lets wait for a couple of days to see if other folks mentioned have any comments..
Thank you @ayushtkn . |
🎊 +1 overall
This message was automatically generated. |
Thanks @ayushtkn . |
…FS (apache#4067). Contributed by tomscut. Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
JIRA: HDFS-16503.
When creating a file using WebHDFS, there are two main steps:
Currently
NameNodeRpcServer
verifies that pathName is valid, butNamenodeWebHdfsMethods
andRouterWebHdfsMethods
do not.So if we use an invalid path(such as duplicated slash), the first step returns success, but the second step throws an
InvalidPathException
.IMO, we should also do the validation in WebHdfs, which is consistent with the
NameNodeRpcServer
.The same WebHDFS operations are:
CREATE
,APPEND
,OPEN
,GETFILECHECKSUM
. So we can addDFSUtil.isValidName
toredirectURI
forNamenodeWebHdfsMethods
andRouterWebHdfsMethods
.