From cf7b0174221291b44cb950406e4ebf201c5d1c5b Mon Sep 17 00:00:00 2001 From: Alejandro Abdelnur Date: Wed, 23 May 2012 22:22:55 +0000 Subject: [PATCH] MAPREDUCE-4276. Allow setting yarn.nodemanager.delete.debug-delay-sec property to -1 for easier container debugging. (ahmed via tucu) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1342075 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-mapreduce-project/CHANGES.txt | 2 ++ .../server/nodemanager/DeletionService.java | 6 ++-- .../nodemanager/TestDeletionService.java | 33 +++++++++++++++++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index d35c4316ec8..4c7019ef0b5 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -136,6 +136,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));