You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "ayushtkn (via GitHub)" <gi...@apache.org> on 2023/02/13 19:04:24 UTC

[GitHub] [hadoop] ayushtkn commented on a diff in pull request #5251: HADOOP-18582. skip unnecessary cleanup logic in distcp

ayushtkn commented on code in PR #5251:
URL: https://github.com/apache/hadoop/pull/5251#discussion_r1104904672


##########
hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/CopyCommitter.java:
##########
@@ -152,9 +152,18 @@ public void abortJob(JobContext jobContext,
   }
 
   private void cleanupTempFiles(JobContext context) {
-    try {
-      Configuration conf = context.getConfiguration();
+    Configuration conf = context.getConfiguration();
+
+    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) {

Review Comment:
   Isn't that same check as here in RetriableFileCopyCommand
   ```
       final boolean toAppend = action == FileAction.APPEND;
       final boolean useTempTarget = !toAppend && !directWrite;
       Path targetPath = useTempTarget ? getTempFile(target, context) : target;
   ```
   https://github.com/apache/hadoop/blob/trunk/hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/RetriableFileCopyCommand.java#L135-L137



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org