diff --git a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/CopyCommitter.java b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/CopyCommitter.java index 4ba05794a0..14eb8cfb8a 100644 --- a/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/CopyCommitter.java +++ b/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/CopyCommitter.java @@ -156,10 +156,7 @@ private void cleanupTempFiles(JobContext context) { final boolean directWrite = conf.getBoolean( DistCpOptionSwitch.DIRECT_WRITE.getConfigLabel(), false); - final boolean append = conf.getBoolean( - DistCpOptionSwitch.APPEND.getConfigLabel(), false); - final boolean useTempTarget = !append && !directWrite; - if (!useTempTarget) { + if (directWrite) { return; } diff --git a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java index f2dd246db5..6a537dc6e7 100644 --- a/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java +++ b/hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java @@ -586,13 +586,11 @@ fs, new Path(targetBase + srcFilename), @Test public void testCommitWithCleanupTempFiles() throws IOException { - testCommitWithCleanup(true, false); - testCommitWithCleanup(false, true); - testCommitWithCleanup(true, true); - testCommitWithCleanup(false, false); + testCommitWithCleanup(true); + testCommitWithCleanup(false); } - private void testCommitWithCleanup(boolean append, boolean directWrite)throws IOException { + private void testCommitWithCleanup(boolean directWrite) throws IOException { TaskAttemptContext taskAttemptContext = getTaskAttemptContext(config); JobID jobID = taskAttemptContext.getTaskAttemptID().getJobID(); JobContext jobContext = new JobContextImpl( @@ -611,7 +609,7 @@ private void testCommitWithCleanup(boolean append, boolean directWrite)throws IO DistCpOptions options = new DistCpOptions.Builder( Collections.singletonList(new Path(sourceBase)), new Path("/out")) - .withAppend(append) + .withAppend(true) .withSyncFolder(true) .withDirectWrite(directWrite) .build(); @@ -631,7 +629,7 @@ private void testCommitWithCleanup(boolean append, boolean directWrite)throws IO null, taskAttemptContext); committer.commitJob(jobContext); - if (append || directWrite) { + if (directWrite) { ContractTestUtils.assertPathExists(fs, "Temp files should not be cleanup with append or direct option", tempFilePath); } else {