MAPREDUCE-6044. Fully qualified intermediate done dir path breaks per-user dir creation on Windows. Contributed by Zhijie Shen.
svn merge --ignore-ancestry -c 1619863 ../../trunk/ git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1619864 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
21843592db
commit
7cad25ec94
|
@ -96,6 +96,9 @@ Release 2.6.0 - UNRELEASED
|
|||
MAPREDUCE-6012. DBInputSplit creates invalid ranges on Oracle.
|
||||
(Wei Yan via kasha)
|
||||
|
||||
MAPREDUCE-6044. Fully qualified intermediate done dir path breaks per-user dir
|
||||
creation on Windows. (zjshen)
|
||||
|
||||
Release 2.5.0 - 2014-08-11
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -25,7 +25,6 @@ import static org.mockito.Mockito.spy;
|
|||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
import static org.mockito.Mockito.never;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
|
@ -53,6 +52,8 @@ import org.apache.hadoop.mapreduce.v2.api.records.JobId;
|
|||
import org.apache.hadoop.mapreduce.v2.app.AppContext;
|
||||
import org.apache.hadoop.mapreduce.v2.app.job.Job;
|
||||
import org.apache.hadoop.mapreduce.v2.app.job.JobStateInternal;
|
||||
import org.apache.hadoop.mapreduce.v2.jobhistory.JHAdminConfig;
|
||||
import org.apache.hadoop.mapreduce.v2.jobhistory.JobHistoryUtils;
|
||||
import org.apache.hadoop.mapreduce.v2.util.MRBuilderUtils;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||
|
@ -399,6 +400,33 @@ public class TestJobHistoryEventHandler {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetHistoryIntermediateDoneDirForUser() throws IOException {
|
||||
// Test relative path
|
||||
Configuration conf = new Configuration();
|
||||
conf.set(JHAdminConfig.MR_HISTORY_INTERMEDIATE_DONE_DIR,
|
||||
"/mapred/history/done_intermediate");
|
||||
conf.set(MRJobConfig.USER_NAME, System.getProperty("user.name"));
|
||||
String pathStr = JobHistoryUtils.getHistoryIntermediateDoneDirForUser(conf);
|
||||
Assert.assertEquals("/mapred/history/done_intermediate/" +
|
||||
System.getProperty("user.name"), pathStr);
|
||||
|
||||
// Test fully qualified path
|
||||
// Create default configuration pointing to the minicluster
|
||||
conf.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY,
|
||||
dfsCluster.getURI().toString());
|
||||
FileOutputStream os = new FileOutputStream(coreSitePath);
|
||||
conf.writeXml(os);
|
||||
os.close();
|
||||
// Simulate execution under a non-default namenode
|
||||
conf.set(CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY,
|
||||
"file:///");
|
||||
pathStr = JobHistoryUtils.getHistoryIntermediateDoneDirForUser(conf);
|
||||
Assert.assertEquals(dfsCluster.getURI().toString() +
|
||||
"/mapred/history/done_intermediate/" + System.getProperty("user.name"),
|
||||
pathStr);
|
||||
}
|
||||
|
||||
private void queueEvent(JHEvenHandlerForTest jheh, JobHistoryEvent event) {
|
||||
jheh.handle(event);
|
||||
}
|
||||
|
|
|
@ -292,8 +292,8 @@ public class JobHistoryUtils {
|
|||
* @return the intermediate done directory for jobhistory files.
|
||||
*/
|
||||
public static String getHistoryIntermediateDoneDirForUser(Configuration conf) throws IOException {
|
||||
return getConfiguredHistoryIntermediateDoneDirPrefix(conf) + File.separator
|
||||
+ UserGroupInformation.getCurrentUser().getShortUserName();
|
||||
return new Path(getConfiguredHistoryIntermediateDoneDirPrefix(conf),
|
||||
UserGroupInformation.getCurrentUser().getShortUserName()).toString();
|
||||
}
|
||||
|
||||
public static boolean shouldCreateNonUserDirectory(Configuration conf) {
|
||||
|
|
Loading…
Reference in New Issue