Merge -r 1342074:1342075 from trunk to branch. FIXES: MAPREDUCE-4276

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1342076 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Alejandro Abdelnur 2012-05-23 22:23:50 +00:00
parent e4b5b99e8e
commit 897314775b
3 changed files with 39 additions and 2 deletions

View File

@ -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

View File

@ -68,8 +68,10 @@ public DeletionService(ContainerExecutor exec) {
*/
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

View File

@ -163,6 +163,39 @@ public void testRelativeDelete() throws Exception {
}
}
@Test
public void testNoDelete() throws Exception {
Random r = new Random();
long seed = r.nextLong();
r.setSeed(seed);
System.out.println("SEED: " + seed);
List<Path> 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));