diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index d121fff4503..91d3424a318 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -27,6 +27,8 @@ Release 2.0.1-alpha - UNRELEASED MAPREDUCE-4262. NM gives wrong log message saying "Connected to ResourceManager" before trying to connect. (Devaraj K via tgraves) + MAPREDUCE-4276. Allow setting yarn.nodemanager.delete.debug-delay-sec property to "-1" for easier container debugging. (ahmed via tucu) + Release 2.0.0-alpha - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DeletionService.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DeletionService.java index 7d4de873e3f..4ce630a9517 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DeletionService.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DeletionService.java @@ -68,8 +68,10 @@ public class DeletionService extends AbstractService { */ public void delete(String user, Path subDir, Path... baseDirs) { // TODO if parent owned by NM, rename within parent inline - sched.schedule(new FileDeletion(user, subDir, baseDirs), - debugDelay, TimeUnit.SECONDS); + if (debugDelay != -1) { + sched.schedule(new FileDeletion(user, subDir, baseDirs), debugDelay, + TimeUnit.SECONDS); + } } @Override diff --git a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestDeletionService.java b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestDeletionService.java index 28b51c0632f..d91b3acf157 100644 --- a/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestDeletionService.java +++ b/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestDeletionService.java @@ -163,6 +163,39 @@ public class TestDeletionService { } } + @Test + public void testNoDelete() throws Exception { + Random r = new Random(); + long seed = r.nextLong(); + r.setSeed(seed); + System.out.println("SEED: " + seed); + List dirs = buildDirs(r, base, 20); + createDirs(new Path("."), dirs); + FakeDefaultContainerExecutor exec = new FakeDefaultContainerExecutor(); + Configuration conf = new Configuration(); + conf.setInt(YarnConfiguration.DEBUG_NM_DELETE_DELAY_SEC, -1); + exec.setConf(conf); + DeletionService del = new DeletionService(exec); + del.init(conf); + del.start(); + try { + for (Path p : dirs) { + del.delete((Long.parseLong(p.getName()) % 2) == 0 ? null : "dingo", p, + null); + } + int msecToWait = 20 * 1000; + for (Path p : dirs) { + while (msecToWait > 0 && lfs.util().exists(p)) { + Thread.sleep(100); + msecToWait -= 100; + } + assertTrue(lfs.util().exists(p)); + } + } finally { + del.stop(); + } + } + @Test public void testStopWithDelayedTasks() throws Exception { DeletionService del = new DeletionService(Mockito.mock(ContainerExecutor.class));