Return-Path: X-Original-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Delivered-To: apmail-hadoop-hdfs-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 325A710D83 for ; Mon, 25 Nov 2013 18:09:22 +0000 (UTC) Received: (qmail 24292 invoked by uid 500); 25 Nov 2013 18:09:21 -0000 Delivered-To: apmail-hadoop-hdfs-commits-archive@hadoop.apache.org Received: (qmail 24215 invoked by uid 500); 25 Nov 2013 18:09:20 -0000 Mailing-List: contact hdfs-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hdfs-dev@hadoop.apache.org Delivered-To: mailing list hdfs-commits@hadoop.apache.org Received: (qmail 24195 invoked by uid 99); 25 Nov 2013 18:09:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Nov 2013 18:09:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Nov 2013 18:09:18 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B1235238883D; Mon, 25 Nov 2013 18:08:57 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1545358 - in /hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs: ./ src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/ src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/ Date: Mon, 25 Nov 2013 18:08:57 -0000 To: hdfs-commits@hadoop.apache.org From: jing9@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20131125180857.B1235238883D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: jing9 Date: Mon Nov 25 18:08:57 2013 New Revision: 1545358 URL: http://svn.apache.org/r1545358 Log: HDFS-5533. Merge change r1545357 from trunk. Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/INodeDirectoryWithSnapshot.java hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1545358&r1=1545357&r2=1545358&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Mon Nov 25 18:08:57 2013 @@ -210,6 +210,9 @@ Release 2.3.0 - UNRELEASED HDFS-5552. Fix wrong information of "Cluster summay" in dfshealth.html. (Haohui Mai via jing9) + HDFS-5533. Symlink delete/create should be treated as DELETE/CREATE in snapshot diff + report. (Binglin Chang via jing9) + Release 2.2.1 - UNRELEASED INCOMPATIBLE CHANGES Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/INodeDirectoryWithSnapshot.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/INodeDirectoryWithSnapshot.java?rev=1545358&r1=1545357&r2=1545358&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/INodeDirectoryWithSnapshot.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/snapshot/INodeDirectoryWithSnapshot.java Mon Nov 25 18:08:57 2013 @@ -186,14 +186,10 @@ public class INodeDirectoryWithSnapshot INode dnode = deleted.get(d); if (cnode.compareTo(dnode.getLocalNameBytes()) == 0) { fullPath[fullPath.length - 1] = cnode.getLocalNameBytes(); - if (cnode.isSymlink() && dnode.isSymlink()) { - dList.add(new DiffReportEntry(DiffType.MODIFY, fullPath)); - } else { - // must be the case: delete first and then create an inode with the - // same name - cList.add(new DiffReportEntry(DiffType.CREATE, fullPath)); - dList.add(new DiffReportEntry(DiffType.DELETE, fullPath)); - } + // must be the case: delete first and then create an inode with the + // same name + cList.add(new DiffReportEntry(DiffType.CREATE, fullPath)); + dList.add(new DiffReportEntry(DiffType.DELETE, fullPath)); c++; d++; } else if (cnode.compareTo(dnode.getLocalNameBytes()) < 0) { Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java?rev=1545358&r1=1545357&r2=1545358&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/snapshot/TestSnapshotDiffReport.java Mon Nov 25 18:08:57 2013 @@ -92,12 +92,15 @@ public class TestSnapshotDiffReport { Path file11 = new Path(modifyDir, "file11"); Path file12 = new Path(modifyDir, "file12"); Path file13 = new Path(modifyDir, "file13"); + Path link13 = new Path(modifyDir, "link13"); Path file14 = new Path(modifyDir, "file14"); Path file15 = new Path(modifyDir, "file15"); DFSTestUtil.createFile(hdfs, file10, BLOCKSIZE, REPLICATION_1, seed); DFSTestUtil.createFile(hdfs, file11, BLOCKSIZE, REPLICATION_1, seed); DFSTestUtil.createFile(hdfs, file12, BLOCKSIZE, REPLICATION_1, seed); DFSTestUtil.createFile(hdfs, file13, BLOCKSIZE, REPLICATION_1, seed); + // create link13 + hdfs.createSymlink(file13, link13, false); // create snapshot for (Path snapshotDir : snapshotDirs) { hdfs.allowSnapshot(snapshotDir); @@ -110,6 +113,8 @@ public class TestSnapshotDiffReport { hdfs.setReplication(file12, REPLICATION); // modify file13 hdfs.setReplication(file13, REPLICATION); + // delete link13 + hdfs.delete(link13, false); // create file14 DFSTestUtil.createFile(hdfs, file14, BLOCKSIZE, REPLICATION, seed); // create file15 @@ -126,6 +131,8 @@ public class TestSnapshotDiffReport { hdfs.delete(file12, true); // modify file13 hdfs.setReplication(file13, (short) (REPLICATION - 2)); + // create link13 again + hdfs.createSymlink(file13, link13, false); // delete file14 hdfs.delete(file14, true); // modify file15 @@ -222,7 +229,9 @@ public class TestSnapshotDiffReport { new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes("file12")), new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes("file11")), new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("file11")), - new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("file13"))); + new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("file13")), + new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes("link13")), + new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("link13"))); verifyDiffReport(sub1, "s0", "s5", new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("")), @@ -232,6 +241,8 @@ public class TestSnapshotDiffReport { new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes("file11")), new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("file11")), new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("file13")), + new DiffReportEntry(DiffType.DELETE, DFSUtil.string2Bytes("link13")), + new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("link13")), new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("subsub1/subsubsub1")), new DiffReportEntry(DiffType.CREATE, @@ -241,6 +252,8 @@ public class TestSnapshotDiffReport { new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("subsub1/subsubsub1/file13")), new DiffReportEntry(DiffType.CREATE, + DFSUtil.string2Bytes("subsub1/subsubsub1/link13")), + new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("subsub1/subsubsub1/file15"))); verifyDiffReport(sub1, "s2", "s5", @@ -254,6 +267,8 @@ public class TestSnapshotDiffReport { new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("subsub1/subsubsub1/file13")), new DiffReportEntry(DiffType.CREATE, + DFSUtil.string2Bytes("subsub1/subsubsub1/link13")), + new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("subsub1/subsubsub1/file15"))); verifyDiffReport(sub1, "s3", "", @@ -270,7 +285,11 @@ public class TestSnapshotDiffReport { new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("subsub1/subsubsub1/file11")), new DiffReportEntry(DiffType.MODIFY, - DFSUtil.string2Bytes("subsub1/subsubsub1/file13"))); + DFSUtil.string2Bytes("subsub1/subsubsub1/file13")), + new DiffReportEntry(DiffType.CREATE, + DFSUtil.string2Bytes("subsub1/subsubsub1/link13")), + new DiffReportEntry(DiffType.DELETE, + DFSUtil.string2Bytes("subsub1/subsubsub1/link13"))); } /** @@ -300,7 +319,11 @@ public class TestSnapshotDiffReport { new DiffReportEntry(DiffType.CREATE, DFSUtil.string2Bytes("subsub1/subsubsub1/file11")), new DiffReportEntry(DiffType.MODIFY, - DFSUtil.string2Bytes("subsub1/subsubsub1/file13"))); + DFSUtil.string2Bytes("subsub1/subsubsub1/file13")), + new DiffReportEntry(DiffType.CREATE, + DFSUtil.string2Bytes("subsub1/subsubsub1/link13")), + new DiffReportEntry(DiffType.DELETE, + DFSUtil.string2Bytes("subsub1/subsubsub1/link13"))); // check diff report between s0 and the current status verifyDiffReport(sub1, "s0", "", new DiffReportEntry(DiffType.MODIFY, DFSUtil.string2Bytes("")),