hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yongjun Zhang (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-6500) Snapshot shouldn't be removed silently after renaming to an existing snapshot
Date Sat, 07 Jun 2014 15:31:02 GMT

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

Yongjun Zhang commented on HDFS-6500:
-------------------------------------

Hi [~djp], 

Thanks for finding and reporting the issue. I did a quick check at the source code level,
it seems to be doing the checking for existing snapshot.
I wonder if you saw any exception from the following code. 

INodeDirectorySnapshottable.java:
{code}
  public void renameSnapshot(String path, String oldName, String newName)
      throws SnapshotException {
    if (newName.equals(oldName)) {
      return;
    }
    final int indexOfOld = searchSnapshot(DFSUtil.string2Bytes(oldName));
    if (indexOfOld < 0) {
      throw new SnapshotException("The snapshot " + oldName
          + " does not exist for directory " + path);
    } else {
      final byte[] newNameBytes = DFSUtil.string2Bytes(newName);
      int indexOfNew = searchSnapshot(newNameBytes);
      if (indexOfNew > 0) {
        throw new SnapshotException("The snapshot " + newName
            + " already exists for directory " + path);
      }
{code}

Thanks.


> Snapshot shouldn't be removed silently after renaming to an existing snapshot
> -----------------------------------------------------------------------------
>
>                 Key: HDFS-6500
>                 URL: https://issues.apache.org/jira/browse/HDFS-6500
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: snapshots
>    Affects Versions: 2.4.0
>            Reporter: Junping Du
>            Priority: Blocker
>
> Assume you have two snapshots for /dir: s1, s2, when you do "hdfs dfs 
> -renameSnapshot /dir s2 s1" which means you want to rename s2 to s1. It will cause s2
been dropped silently and s1 still keep the previous one. This is very confusing and easily
cause wrong operation.
> The right behavior should be providing a warning to remind user that the target name
is already existed and do nothing. If user do want to overlap s1, he should add some option
(i.e. "-f") or delete s1 first.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message