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 A844A925F for ; Mon, 16 Apr 2012 22:09:07 +0000 (UTC) Received: (qmail 92746 invoked by uid 500); 16 Apr 2012 22:09:07 -0000 Delivered-To: apmail-hadoop-hdfs-commits-archive@hadoop.apache.org Received: (qmail 92713 invoked by uid 500); 16 Apr 2012 22:09:07 -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 92704 invoked by uid 99); 16 Apr 2012 22:09:07 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 16 Apr 2012 22:09:07 +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, 16 Apr 2012 22:09:03 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 44B0723888EA; Mon, 16 Apr 2012 22:08:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1326818 - in /hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs: ./ src/main/java/ src/main/java/org/apache/hadoop/hdfs/server/namenode/ src/test/java/org/apache/hadoop/hdfs/server/namenode/ Date: Mon, 16 Apr 2012 22:08:41 -0000 To: hdfs-commits@hadoop.apache.org From: szetszwo@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120416220842.44B0723888EA@eris.apache.org> Author: szetszwo Date: Mon Apr 16 22:08:40 2012 New Revision: 1326818 URL: http://svn.apache.org/viewvc?rev=1326818&view=rev Log: svn merge -c 1326762 from trunk for HDFS-3279. Move the FSEditLog constructor with @VisibleForTesting to TestEditLog. Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/ (props changed) 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/ (props changed) hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java Propchange: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs:r1326762 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=1326818&r1=1326817&r2=1326818&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 Apr 16 22:08:40 2012 @@ -251,6 +251,9 @@ Release 2.0.0 - UNRELEASED HDFS-2708. Stats for the # of blocks per DN. (atm) + HDFS-3279. Move the FSEditLog constructor with @VisibleForTesting to + TestEditLog. (Arpit Gupta via szetszwo) + OPTIMIZATIONS HDFS-2477. Optimize computing the diff between a block report and the Propchange: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/ ------------------------------------------------------------------------------ Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java:r1326762 Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.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/FSEditLog.java?rev=1326818&r1=1326817&r2=1326818&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSEditLog.java Mon Apr 16 22:08:40 2012 @@ -25,7 +25,6 @@ import java.util.Collection; import java.util.List; import java.lang.reflect.Constructor; -import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.classification.InterfaceAudience; @@ -158,20 +157,6 @@ public class FSEditLog { }; /** - * Construct FSEditLog with default configuration, taking editDirs from NNStorage - * - * @param storage Storage object used by namenode - */ - @VisibleForTesting - FSEditLog(NNStorage storage) throws IOException { - Configuration conf = new Configuration(); - // Make sure the edits dirs are set in the provided configuration object. - conf.set(DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY, - StringUtils.join(storage.getEditsDirectories(), ",")); - init(conf, storage, FSNamesystem.getNamespaceEditsDirs(conf)); - } - - /** * Constructor for FSEditLog. Underlying journals are constructed, but * no streams are opened until open() is called. * Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.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/TestEditLog.java?rev=1326818&r1=1326817&r2=1326818&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java (original) +++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/TestEditLog.java Mon Apr 16 22:08:40 2012 @@ -142,6 +142,20 @@ public class TestEditLog extends TestCas } } } + + /** + * Construct FSEditLog with default configuration, taking editDirs from NNStorage + * + * @param storage Storage object used by namenode + */ + private static FSEditLog getFSEditLog(NNStorage storage) throws IOException { + Configuration conf = new Configuration(); + // Make sure the edits dirs are set in the provided configuration object. + conf.set(DFSConfigKeys.DFS_NAMENODE_EDITS_DIR_KEY, + StringUtils.join(",", storage.getEditsDirectories())); + FSEditLog log = new FSEditLog(conf, storage, FSNamesystem.getNamespaceEditsDirs(conf)); + return log; + } /** * Test case for an empty edit log from a prior version of Hadoop. @@ -864,7 +878,7 @@ public class TestEditLog extends TestCas storage = mockStorageWithEdits( "[1,100]|[101,200]|[201,]", "[1,100]|[101,200]|[201,]"); - log = new FSEditLog(storage); + log = getFSEditLog(storage); log.initJournalsForWrite(); assertEquals("[[1,100], [101,200]]", log.getEditLogManifest(1).toString()); @@ -876,7 +890,7 @@ public class TestEditLog extends TestCas storage = mockStorageWithEdits( "[1,100]|[101,200]", "[1,100]|[201,300]|[301,400]"); // nothing starting at 101 - log = new FSEditLog(storage); + log = getFSEditLog(storage); log.initJournalsForWrite(); assertEquals("[[1,100], [101,200], [201,300], [301,400]]", log.getEditLogManifest(1).toString()); @@ -886,7 +900,7 @@ public class TestEditLog extends TestCas storage = mockStorageWithEdits( "[1,100]|[301,400]", // gap from 101 to 300 "[301,400]|[401,500]"); - log = new FSEditLog(storage); + log = getFSEditLog(storage); log.initJournalsForWrite(); assertEquals("[[301,400], [401,500]]", log.getEditLogManifest(1).toString()); @@ -896,7 +910,7 @@ public class TestEditLog extends TestCas storage = mockStorageWithEdits( "[1,100]|[101,150]", // short log at 101 "[1,50]|[101,200]"); // short log at 1 - log = new FSEditLog(storage); + log = getFSEditLog(storage); log.initJournalsForWrite(); assertEquals("[[1,100], [101,200]]", log.getEditLogManifest(1).toString()); @@ -909,7 +923,7 @@ public class TestEditLog extends TestCas storage = mockStorageWithEdits( "[1,100]|[101,]", "[1,100]|[101,200]"); - log = new FSEditLog(storage); + log = getFSEditLog(storage); log.initJournalsForWrite(); assertEquals("[[1,100], [101,200]]", log.getEditLogManifest(1).toString()); @@ -999,7 +1013,7 @@ public class TestEditLog extends TestCas Collections.emptyList(), editUris); storage.format(new NamespaceInfo()); - FSEditLog editlog = new FSEditLog(storage); + FSEditLog editlog = getFSEditLog(storage); // open the edit log and add two transactions // logGenerationStamp is used, simply because it doesn't // require complex arguments. @@ -1081,7 +1095,7 @@ public class TestEditLog extends TestCas new AbortSpec(9, 0), new AbortSpec(10, 1)); long totaltxnread = 0; - FSEditLog editlog = new FSEditLog(storage); + FSEditLog editlog = getFSEditLog(storage); editlog.initJournalsForWrite(); long startTxId = 1; Iterable editStreams = editlog.selectInputStreams(startTxId, @@ -1131,7 +1145,7 @@ public class TestEditLog extends TestCas assertEquals(1, files.length); assertTrue(files[0].delete()); - FSEditLog editlog = new FSEditLog(storage); + FSEditLog editlog = getFSEditLog(storage); editlog.initJournalsForWrite(); long startTxId = 1; try {