[ https://issues.apache.org/jira/browse/MAPREDUCE-6607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15140735#comment-15140735 ]
Kai Sasaki commented on MAPREDUCE-6607: --------------------------------------- [~ozawa] Sure, but it's weird. Although HDFS-9686 patch does not seem to include the test of {{TestStagingCleanup}}, the commit includes the test code I've written here. {code} git show fe124da5ffc16e4795c3dd5542accd58361e1b08 ... --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestStagingCleanup.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestStagingCleanup.java @@ -245,6 +245,63 @@ public void testDeletionofStagingOnKillLastTry() throws IOException { verify(fs).delete(stagingJobPath, true); } + @Test + public void testByPreserveFailedStaging() throws IOException { + conf.set(MRJobConfig.MAPREDUCE_JOB_DIR, stagingJobDir); + // Failed task's staging files should be kept + conf.setBoolean(MRJobConfig.PRESERVE_FAILED_TASK_FILES, true); + fs = mock(FileSystem.class); + when(fs.delete(any(Path.class), anyBoolean())).thenReturn(true); ... {code} Updating {{TestStagingCleanup}} does not seem to related to HDFS-9686 basically. Is it included by accident? > .staging dir is not cleaned up if mapreduce.task.files.preserve.failedtask or > mapreduce.task.files.preserve.filepattern are set > ------------------------------------------------------------------------------------------------------------------------------- > > Key: MAPREDUCE-6607 > URL: https://issues.apache.org/jira/browse/MAPREDUCE-6607 > Project: Hadoop Map/Reduce > Issue Type: Bug > Components: applicationmaster > Affects Versions: 2.7.1 > Reporter: Maysam Yabandeh > Assignee: Kai Sasaki > Priority: Minor > Attachments: MAPREDUCE-6607.01.patch > > > if either of the following configs are set, then .staging dir is not cleaned > up: > * mapreduce.task.files.preserve.failedtask > * mapreduce.task.files.preserve.filepattern > The former was supposed to keep only .staging of failed tasks and the latter > was supposed to be used only if that task name matches against the specified > regular expression. > {code} > protected boolean keepJobFiles(JobConf conf) { > return (conf.getKeepTaskFilesPattern() != null || conf > .getKeepFailedTaskFiles()); > } > {code} > {code} > public void cleanupStagingDir() throws IOException { > /* make sure we clean the staging files */ > String jobTempDir = null; > FileSystem fs = getFileSystem(getConfig()); > try { > if (!keepJobFiles(new JobConf(getConfig()))) { > jobTempDir = getConfig().get(MRJobConfig.MAPREDUCE_JOB_DIR); > if (jobTempDir == null) { > LOG.warn("Job Staging directory is null"); > return; > } > Path jobTempDirPath = new Path(jobTempDir); > LOG.info("Deleting staging directory " + > FileSystem.getDefaultUri(getConfig()) + > " " + jobTempDir); > fs.delete(jobTempDirPath, true); > } > } catch(IOException io) { > LOG.error("Failed to cleanup staging dir " + jobTempDir, io); > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)