svn merge -c 1297825 from trunk to branch-0.23 FIXES: MAPREDUCE-3975. Default value not set for Configuration parameter mapreduce.job.local.dir (Eric Payne via bobby)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1297826 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Joseph Evans 2012-03-07 01:28:34 +00:00
parent 9b32863cb8
commit b6d9e6b5f7
2 changed files with 14 additions and 1 deletions

View File

@ -206,6 +206,9 @@ Release 0.23.2 - UNRELEASED
MAPREDUCE-3977. LogAggregationService leaks log aggregator objects MAPREDUCE-3977. LogAggregationService leaks log aggregator objects
(Jason Lowe via bobby) (Jason Lowe via bobby)
MAPREDUCE-3975. Default value not set for Configuration parameter
mapreduce.job.local.dir (Eric Payne via bobby)
Release 0.23.1 - 2012-02-17 Release 0.23.1 - 2012-02-17
NEW FEATURES NEW FEATURES

View File

@ -35,6 +35,7 @@ import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSError; import org.apache.hadoop.fs.FSError;
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.LocalDirAllocator;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission; import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.io.IOUtils;
@ -227,12 +228,21 @@ class YarnChild {
/** /**
* Configure mapred-local dirs. This config is used by the task for finding * Configure mapred-local dirs. This config is used by the task for finding
* out an output directory. * out an output directory.
* @throws IOException
*/ */
private static void configureLocalDirs(Task task, JobConf job) { private static void configureLocalDirs(Task task, JobConf job) throws IOException {
String[] localSysDirs = StringUtils.getTrimmedStrings( String[] localSysDirs = StringUtils.getTrimmedStrings(
System.getenv(ApplicationConstants.LOCAL_DIR_ENV)); System.getenv(ApplicationConstants.LOCAL_DIR_ENV));
job.setStrings(MRConfig.LOCAL_DIR, localSysDirs); job.setStrings(MRConfig.LOCAL_DIR, localSysDirs);
LOG.info(MRConfig.LOCAL_DIR + " for child: " + job.get(MRConfig.LOCAL_DIR)); LOG.info(MRConfig.LOCAL_DIR + " for child: " + job.get(MRConfig.LOCAL_DIR));
LocalDirAllocator lDirAlloc = new LocalDirAllocator(MRConfig.LOCAL_DIR);
Path workDir = lDirAlloc.getLocalPathForWrite("work", job);
FileSystem lfs = FileSystem.getLocal(job).getRaw();
if (!lfs.mkdirs(workDir)) {
throw new IOException("Mkdirs failed to create "
+ workDir.toString());
}
job.set(MRJobConfig.JOB_LOCAL_DIR,workDir.toString());
} }
private static JobConf configureTask(Task task, Credentials credentials, private static JobConf configureTask(Task task, Credentials credentials,