From 0fd0ebae645e671699f6a6a56a012ebe6dfb5b2a Mon Sep 17 00:00:00 2001 From: Jian He Date: Thu, 16 Oct 2014 18:14:34 -0700 Subject: [PATCH] YARN-2682. Updated WindowsSecureContainerExecutor to not use DefaultContainerExecutor#getFirstApplicationDir and use getWorkingDir() instead. Contributed by Zhihai Xu --- hadoop-yarn-project/CHANGES.txt | 4 ++++ .../yarn/server/nodemanager/DefaultContainerExecutor.java | 7 +------ .../server/nodemanager/WindowsSecureContainerExecutor.java | 5 ++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 432f35af6d..6d2eb08b05 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -360,6 +360,10 @@ Release 2.6.0 - UNRELEASED YARN-2621. Simplify the output when the user doesn't have the access for getDomain(s). (Zhijie Shen via jianhe) + YARN-2682. Updated WindowsSecureContainerExecutor to not use + DefaultContainerExecutor#getFirstApplicationDir and use getWorkingDir() + instead. (Zhihai Xu via jianhe) + OPTIMIZATIONS BUG FIXES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java index 5d1e3df550..2e1d94d1bc 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java @@ -462,11 +462,6 @@ public void deleteAsUser(String user, Path subDir, Path... baseDirs) * $logdir/$user/$appId */ static final short LOGDIR_PERM = (short)0710; - protected Path getFirstApplicationDir(List localDirs, String user, - String appId) { - return getApplicationDir(new Path(localDirs.get(0)), user, appId); - } - private long getDiskFreeSpace(Path base) throws IOException { return lfs.getFsStatus(base).getRemaining(); } @@ -489,7 +484,7 @@ private Path getFileCacheDir(Path base, String user) { ContainerLocalizer.FILECACHE); } - private Path getWorkingDir(List localDirs, String user, + protected Path getWorkingDir(List localDirs, String user, String appId) throws IOException { Path appStorageDir = null; long totalAvailable = 0L; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/WindowsSecureContainerExecutor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/WindowsSecureContainerExecutor.java index 30beaf8da3..fc6c64f530 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/WindowsSecureContainerExecutor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/WindowsSecureContainerExecutor.java @@ -115,9 +115,8 @@ public void startLocalizer(Path nmPrivateContainerTokens, createUserCacheDirs(localDirs, user); createAppDirs(localDirs, user, appId); createAppLogDirs(appId, logDirs, user); - - // TODO: Why pick first app dir. The same in LCE why not random? - Path appStorageDir = getFirstApplicationDir(localDirs, user, appId); + + Path appStorageDir = getWorkingDir(localDirs, user, appId); String tokenFn = String.format(ContainerLocalizer.TOKEN_FILE_NAME_FMT, locId); Path tokenDst = new Path(appStorageDir, tokenFn);