Dieter De Paepe created HADOOP-18988:
----------------------------------------

             Summary: Snapshotdiff does not detect rename if parent dir removed
                 Key: HADOOP-18988
                 URL: https://issues.apache.org/jira/browse/HADOOP-18988
             Project: Hadoop Common
          Issue Type: Bug
          Components: fs
    Affects Versions: 3.3.6
            Reporter: Dieter De Paepe


In the example case below, the diff reports the moved folder as a CREATE, where 
it should be a RENAME.

This means that applications using the diff report (such as DistCP) will have 
to transfer data where a simple move would suffice.
{code:java}
DistributedFileSystem fs = (DistributedFileSystem) this.fs;

createHdfsFile(new Path("/level1/level2/file"), "content");
fs.allowSnapshot(new Path("/"));
fs.createSnapshot(new Path("/"), "snapshot1");

fs.rename(new Path("/level1/level2/"), new Path("/level2-root"));
fs.delete(new Path("/level1"), true);
fs.createSnapshot(new Path("/"), "snapshot2");

SnapshotDiffReport snapshotDiff =
        fs.getSnapshotDiffReport(new Path("/"), "snapshot1", "snapshot2");
System.out.println(snapshotDiff);
//        Difference between snapshot snapshot1 and snapshot snapshot2 under 
directory /:
//        M .
//        + ./level2-root
//        - ./level1

// If the delete is commented out:
//        M .
//        M ./level1
//        R ./level1/level2 -> ./level2-root{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to