[ 
https://issues.apache.org/jira/browse/HDFS-3626?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Todd Lipcon updated HDFS-3626:
------------------------------

    Attachment: hdfs-3626.txt

This patch fixes the issue in several places:

- Modifies {{FSDirectory.addFile(...)}} so that, if someone tries to create the 
file "/", it fails gracefully instead of throwing an NPE.
- Modifies DFSUtil.isValidName() to check for "//" in the middle of a path, 
since other parts of the NN barf if they hit this.
- Modifies the {{Path(URI)}} constructor that the shell was using to properly 
normalize the URI.

The tests check non-canonical paths via three paths: creating a Path with a 
URI, creating a Path from a string, and directly RPCing to the NameNode (since 
we don't want to rely on the client side here). When directly RPCing to the NN, 
rather than normalizing the path, the expected behavior is currently to reject 
the create.

I verified this from the commandline as described above: without the patch, I 
reproduced the failure to restart, and with the patch, it correctly creates the 
file as one would expect.
                
> Creating file with invalid path can corrupt edit log
> ----------------------------------------------------
>
>                 Key: HDFS-3626
>                 URL: https://issues.apache.org/jira/browse/HDFS-3626
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: name-node
>    Affects Versions: 2.0.0-alpha
>            Reporter: Todd Lipcon
>            Assignee: Todd Lipcon
>            Priority: Blocker
>         Attachments: hdfs-3626.txt
>
>
> Joris Bontje reports the following:
> The following command results in a corrupt NN editlog (note the double slash 
> and reading from stdin):
> $ cat /usr/share/dict/words | hadoop fs -put - 
> hdfs://localhost:8020//path/file
> After this, restarting the namenode will result into the following fatal 
> exception:
> {code}
> 2012-07-10 06:29:19,910 INFO org.apache.hadoop.hdfs.server.namenode.FSImage: 
> Reading 
> /var/lib/hadoop-hdfs/cache/hdfs/dfs/name/current/edits_0000000000000000173-0000000000000000188
>  expecting start txid #173
> 2012-07-10 06:29:19,912 ERROR 
> org.apache.hadoop.hdfs.server.namenode.FSEditLogLoader: Encountered exception 
> on operation MkdirOp [length=0, path=/, timestamp=1341915658216, 
> permissions=cloudera:supergroup:rwxr-xr-x, opCode=OP_MKDIR, txid=182]
> java.lang.ArrayIndexOutOfBoundsException: -1
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to