[
https://issues.apache.org/jira/browse/HDFS-12981?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16308961#comment-16308961
]
Sailesh Patel commented on HDFS-12981:
--------------------------------------
Technically, it does not make sense to rename to itself ( effectively nothing
to do) but if the customers scripts are dependent on an error code, then it
breaks the customers code.
The code in DirectorySnapshottableFeature.java is doing as expected. If the
snapshot oldname and newname are the same, exit as there is nothing to do. If
there is nothing to do, I believe this is done to avoid unnecessary lookups to
check for existent.
119 public void renameSnapshot(String path, String oldName, String newName)
120 throws SnapshotException {
121 if (newName.equals(oldName)) {
122 return;
123 }
Opening this Jira to for community discussion.
> HDFS renameSnapshot to Itself for Non Existent snapshot should throw error
> ---------------------------------------------------------------------------
>
> Key: HDFS-12981
> URL: https://issues.apache.org/jira/browse/HDFS-12981
> Project: Hadoop HDFS
> Issue Type: Improvement
> Components: hdfs
> Affects Versions: 2.6.0
> Reporter: Sailesh Patel
> Priority: Minor
>
> When trying to rename a non-existent HDFS snapshot to ITSELF, there are no
> errors and exits with a success code.
> The steps to reproduce this issue is:
> hdfs dfs -mkdir /tmp/dir1
> hdfs dfsadmin -allowSnapshot /tmp/dir1
> hdfs dfs -createSnapshot /tmp/dir1 snap1_dir
> Rename from non-existent to another_non-existent : errors and return code 1.
> This is correct.
> hdfs dfs -renameSnapshot /tmp/dir1 nonexist another_nonexist :
> echo $?
>
> renameSnapshot: The snapshot nonexist does not exist for directory /tmp/dir1
> Rename from non-existent to non-existent : no errors and return code 0
> instead of Error and return code 1.
> hdfs dfs -renameSnapshot /tmp/dir1 nonexist nonexist ; echo $?
> Current behavior: No error and return code 0.
> Expected behavior: An error returned and return code 1.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]