Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8B6E910B1D for ; Tue, 5 May 2015 23:20:46 +0000 (UTC) Received: (qmail 36663 invoked by uid 500); 5 May 2015 23:20:41 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 36484 invoked by uid 500); 5 May 2015 23:20:41 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 35941 invoked by uid 99); 5 May 2015 23:20:41 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 May 2015 23:20:41 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6734EE00E0; Tue, 5 May 2015 23:20:41 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jitendra@apache.org To: common-commits@hadoop.apache.org Date: Tue, 05 May 2015 23:20:49 -0000 Message-Id: <7a2a61daf75740dca40b750e9805bedd@git.apache.org> In-Reply-To: <9c37ece42e75453b95f34a3f5b34ffb2@git.apache.org> References: <9c37ece42e75453b95f34a3f5b34ffb2@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [09/17] hadoop git commit: HDFS-8305: HDFS INotify: the destination field of RenameOp should always end with the file name (cmccabe) HDFS-8305: HDFS INotify: the destination field of RenameOp should always end with the file name (cmccabe) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/fcd4cb75 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/fcd4cb75 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/fcd4cb75 Branch: refs/heads/HDFS-7240 Commit: fcd4cb751665adb241081e42b3403c3856b6c6fe Parents: b7dd3a4 Author: Colin Patrick Mccabe Authored: Tue May 5 10:50:09 2015 -0700 Committer: Colin Patrick Mccabe Committed: Tue May 5 10:50:09 2015 -0700 ---------------------------------------------------------------------- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../hadoop/hdfs/server/namenode/FSDirRenameOp.java | 2 +- .../apache/hadoop/hdfs/server/namenode/FSEditLog.java | 10 +++++++--- .../hadoop/hdfs/TestDFSInotifyEventInputStream.java | 11 +++++++++++ 4 files changed, 22 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/fcd4cb75/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index cd9b7b8..08ab7e7 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -682,6 +682,9 @@ Release 2.7.1 - UNRELEASED HDFS-8091: ACLStatus and XAttributes should be presented to INodeAttributesProvider before returning to client (asuresh) + HDFS-8305: HDFS INotify: the destination field of RenameOp should always + end with the file name (cmccabe) + Release 2.7.0 - 2015-04-20 INCOMPATIBLE CHANGES http://git-wip-us.apache.org/repos/asf/hadoop/blob/fcd4cb75/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java index c57cae2..4a20a62 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirRenameOp.java @@ -476,7 +476,7 @@ class FSDirRenameOp { fsd.writeUnlock(); } if (stat) { - fsd.getEditLog().logRename(src, dst, mtime, logRetryCache); + fsd.getEditLog().logRename(src, actualDst, mtime, logRetryCache); return true; } return false; http://git-wip-us.apache.org/repos/asf/hadoop/blob/fcd4cb75/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java index bda827a..28e150c 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java @@ -815,7 +815,9 @@ public class FSEditLog implements LogsPurgeable { } /** - * Add rename record to edit log + * Add rename record to edit log. + * + * The destination should be the file name, not the destination directory. * TODO: use String parameters until just before writing to disk */ void logRename(String src, String dst, long timestamp, boolean toLogRpcIds) { @@ -826,9 +828,11 @@ public class FSEditLog implements LogsPurgeable { logRpcIds(op, toLogRpcIds); logEdit(op); } - + /** - * Add rename record to edit log + * Add rename record to edit log. + * + * The destination should be the file name, not the destination directory. */ void logRename(String src, String dst, long timestamp, boolean toLogRpcIds, Options.Rename... options) { http://git-wip-us.apache.org/repos/asf/hadoop/blob/fcd4cb75/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSInotifyEventInputStream.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSInotifyEventInputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSInotifyEventInputStream.java index 6e91e06..ba33bd3 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSInotifyEventInputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDFSInotifyEventInputStream.java @@ -135,6 +135,7 @@ public class TestDFSInotifyEventInputStream { client.setAcl("/file5", AclEntry.parseAclSpec( "user::rwx,user:foo:rw-,group::r--,other::---", true)); client.removeAcl("/file5"); // SetAclOp -> MetadataUpdateEvent + client.rename("/file5", "/dir"); // RenameOldOp -> RenameEvent EventBatch batch = null; @@ -343,6 +344,16 @@ public class TestDFSInotifyEventInputStream { Event.MetadataUpdateEvent.MetadataType.ACLS); Assert.assertTrue(mue8.getAcls() == null); + // RenameOp (2) + batch = waitForNextEvents(eis); + Assert.assertEquals(1, batch.getEvents().length); + txid = checkTxid(batch, txid); + Assert.assertTrue(batch.getEvents()[0].getEventType() == Event.EventType.RENAME); + Event.RenameEvent re3 = (Event.RenameEvent) batch.getEvents()[0]; + Assert.assertTrue(re3.getDstPath().equals("/dir/file5")); + Assert.assertTrue(re3.getSrcPath().equals("/file5")); + Assert.assertTrue(re.getTimestamp() > 0); + // Returns null when there are no further events Assert.assertTrue(eis.poll() == null);