Browse Source

Revert "HADOOP-15850. CopyCommitter#concatFileChunks should check that the blocks per chunk is not 0. Contributed by Ted Yu."

This reverts commit 437c5187cd82f45ab709f9b87dba75d2911f20e4.
Wei-Chiu Chuang 6 years ago
parent
commit
8754c0b65e

+ 1 - 7
hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/CopyCommitter.java

@@ -69,7 +69,6 @@ public class CopyCommitter extends FileOutputCommitter {
   private boolean overwrite = false;
   private boolean targetPathExists = true;
   private boolean ignoreFailures = false;
-  private int blocksPerChunk = 0;
 
   /**
    * Create a output committer
@@ -80,9 +79,6 @@ public class CopyCommitter extends FileOutputCommitter {
    */
   public CopyCommitter(Path outputPath, TaskAttemptContext context) throws IOException {
     super(outputPath, context);
-    blocksPerChunk = context.getConfiguration().getInt(
-        DistCpOptionSwitch.BLOCKS_PER_CHUNK.getConfigLabel(), 0);
-    LOG.debug("blocks per chunk {}", blocksPerChunk);
     this.taskAttemptContext = context;
   }
 
@@ -97,9 +93,7 @@ public class CopyCommitter extends FileOutputCommitter {
     ignoreFailures = conf.getBoolean(
         DistCpOptionSwitch.IGNORE_FAILURES.getConfigLabel(), false);
 
-    if (blocksPerChunk > 0) {
-      concatFileChunks(conf);
-    }
+    concatFileChunks(conf);
 
     super.commitJob(jobContext);
 

+ 4 - 0
hadoop-tools/hadoop-distcp/src/test/java/org/apache/hadoop/tools/mapred/TestCopyCommitter.java

@@ -82,6 +82,10 @@ public class TestCopyCommitter {
   @Before
   public void createMetaFolder() {
     config.set(DistCpConstants.CONF_LABEL_META_FOLDER, "/meta");
+    // Unset listing file path since the config is shared by
+    // multiple tests, and some test doesn't set it, such as
+    // testNoCommitAction, but the distcp code will check it.
+    config.set(DistCpConstants.CONF_LABEL_LISTING_FILE_PATH, "");
     Path meta = new Path("/meta");
     try {
       cluster.getFileSystem().mkdirs(meta);