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 54C83DC4A for ; Fri, 6 Jul 2012 17:21:09 +0000 (UTC) Received: (qmail 26743 invoked by uid 500); 6 Jul 2012 17:21:09 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 26709 invoked by uid 500); 6 Jul 2012 17:21:09 -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 26702 invoked by uid 99); 6 Jul 2012 17:21:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Jul 2012 17:21:08 +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; Fri, 06 Jul 2012 17:21:06 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 0AE8523889D5; Fri, 6 Jul 2012 17:20:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1358308 - in /hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src: main/java/org/apache/hadoop/fs/LocalDirAllocator.java test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java Date: Fri, 06 Jul 2012 17:20:45 -0000 To: common-commits@hadoop.apache.org From: bobby@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120706172046.0AE8523889D5@eris.apache.org> Author: bobby Date: Fri Jul 6 17:20:45 2012 New Revision: 1358308 URL: http://svn.apache.org/viewvc?rev=1358308&view=rev Log: svn merge -c 1358305 FIXES: MAPREDUCE-4379. Node Manager throws java.lang.OutOfMemoryError: Java heap space due to org.apache.hadoop.fs.LocalDirAllocator.contexts (Devaraj K via bobby) Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java?rev=1358308&r1=1358307&r2=1358308&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java (original) +++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java Fri Jul 6 17:20:45 2012 @@ -207,6 +207,19 @@ public class LocalDirAllocator { return contexts.containsKey(contextCfgItemName); } } + + /** + * Removes the context from the context config items + * + * @param contextCfgItemName + */ + @Deprecated + @InterfaceAudience.LimitedPrivate({"MapReduce"}) + public static void removeContext(String contextCfgItemName) { + synchronized (contexts) { + contexts.remove(contextCfgItemName); + } + } /** We search through all the configured dirs for the file's existence * and return true when we find Modified: hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java?rev=1358308&r1=1358307&r2=1358308&view=diff ============================================================================== --- hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java (original) +++ hadoop/common/branches/branch-2/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java Fri Jul 6 17:20:45 2012 @@ -339,5 +339,18 @@ public class TestLocalDirAllocator { } } + + @Test + public void testRemoveContext() throws IOException { + String dir = buildBufferDir(ROOT, 0); + String contextCfgItemName = "application_1340842292563_0004.app.cache.dirs"; + conf.set(contextCfgItemName, dir); + LocalDirAllocator localDirAllocator = new LocalDirAllocator( + contextCfgItemName); + localDirAllocator.getLocalPathForWrite("p1/x", SMALL_FILE_SIZE, conf); + assertTrue(LocalDirAllocator.isContextValid(contextCfgItemName)); + LocalDirAllocator.removeContext(contextCfgItemName); + assertFalse(LocalDirAllocator.isContextValid(contextCfgItemName)); + } }