steveloughran commented on a change in pull request #1794: HADOOP-15887: Add an option to avoid writing data locally in Distcp URL: https://github.com/apache/hadoop/pull/1794#discussion_r363376799
########## File path: hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/mapred/RetriableFileCopyCommand.java ########## @@ -197,14 +200,25 @@ private long copyToFile(Path targetPath, FileSystem targetFS, targetFS, targetPath); final long blockSize = getBlockSize(fileAttributes, source, targetFS, targetPath); + EnumSet<CreateFlag> createFlags = + EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE); + if (noLocalWrite) { + createFlags.add(CreateFlag.NO_LOCAL_WRITE); + } FSDataOutputStream out = targetFS.create(targetPath, permission, - EnumSet.of(CreateFlag.CREATE, CreateFlag.OVERWRITE), - copyBufferSize, repl, blockSize, context, + createFlags, copyBufferSize, repl, blockSize, context, getChecksumOpt(fileAttributes, sourceChecksum)); outStream = new BufferedOutputStream(out); } else { - outStream = new BufferedOutputStream(targetFS.append(targetPath, - copyBufferSize)); + if (targetFS instanceof DistributedFileSystem && noLocalWrite) { + outStream = new BufferedOutputStream( + ((DistributedFileSystem) targetFS).append(targetPath, Review comment: you need to do an explicit cast here? Ugly. And it will mean we need hadoop-hdfs on the classpath, always, which object stores may not have. We'd be better off (carefully) pulling that HDFS method up ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org