[
https://issues.apache.org/jira/browse/HDFS-6562?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14041422#comment-14041422
]
Tsz Wo Nicholas Sze commented on HDFS-6562:
-------------------------------------------
Patch looks good. Some comments:
- Before the patch, the first if-statement below thows to an exception. But it
will return false after the patch.
{code}
- if (srcInode.isSymlink() &&
- dst.equals(srcInode.asSymlink().getSymlinkString())) {
- throw new FileAlreadyExistsException(
- "Cannot rename symlink "+src+" to its target "+dst);
- }
-
- // dst cannot be directory or a file under src
- if (dst.startsWith(src) &&
- dst.charAt(src.length()) == Path.SEPARATOR_CHAR) {
- NameNode.stateChangeLog.warn("DIR* FSDirectory.unprotectedRenameTo: "
- + "failed to rename " + src + " to " + dst
- + " because destination starts with src");
+
+ try {
+ validateRenameDestination(src, dst, srcInode);
+ } catch (IOException ignored) {
return false;
}
{code}
- prepare() should be combined with the RenameOperation constructor. Then all
the fields except srcChild can be changed to final.
> Refactor rename() in FSDirectory
> --------------------------------
>
> Key: HDFS-6562
> URL: https://issues.apache.org/jira/browse/HDFS-6562
> Project: Hadoop HDFS
> Issue Type: Sub-task
> Components: namenode
> Reporter: Haohui Mai
> Assignee: Haohui Mai
> Attachments: HDFS-6562.000.patch, HDFS-6562.001.patch,
> HDFS-6562.002.patch, HDFS-6562.003.patch, HDFS-6562.004.patch
>
>
> Currently there are two variants of {{rename()}} sitting in {{FSDirectory}}.
> Both implementation shares quite a bit of common code.
> This jira proposes to clean up these two variants and extract the common code.
--
This message was sent by Atlassian JIRA
(v6.2#6252)