hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject svn commit: r1358305 - in /hadoop/common/trunk/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:19:14 GMT
Author: bobby
Date: Fri Jul  6 17:19:13 2012
New Revision: 1358305

URL: http://svn.apache.org/viewvc?rev=1358305&view=rev
Log:
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/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java
    hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java

Modified: hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java?rev=1358305&r1=1358304&r2=1358305&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/LocalDirAllocator.java
Fri Jul  6 17:19:13 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/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java?rev=1358305&r1=1358304&r2=1358305&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java
(original)
+++ hadoop/common/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/TestLocalDirAllocator.java
Fri Jul  6 17:19:13 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));
+  }
 
 }



Mime
View raw message