From a90c7221436ca90e8ad3dd1153258d31ba4e58bc Mon Sep 17 00:00:00 2001 From: Steve Loughran Date: Tue, 16 May 2023 18:16:24 +0100 Subject: [PATCH] HADOOP-18724. [FOLLOW-UP] cherrypick changes from branch-3.3 backport (#5662) * move FileContext.copy() onto optLong() * move FileUtil onto optLong() This brings trunk into sync with the branch-3.3 changes --- .../src/main/java/org/apache/hadoop/fs/FileContext.java | 2 +- .../src/main/java/org/apache/hadoop/fs/FileUtil.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java index 22ac2ecbd7..eb5983f098 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileContext.java @@ -2231,7 +2231,7 @@ public boolean copy(final Path src, final Path dst, boolean deleteSource, InputStream in = awaitFuture(openFile(qSrc) .opt(FS_OPTION_OPENFILE_READ_POLICY, FS_OPTION_OPENFILE_READ_POLICY_WHOLE_FILE) - .opt(FS_OPTION_OPENFILE_LENGTH, + .optLong(FS_OPTION_OPENFILE_LENGTH, fs.getLen()) // file length hint for object stores .build()); try (OutputStream out = create(qDst, createFlag)) { diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java index 2af0a7b9e7..a1a325b925 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java @@ -484,7 +484,7 @@ public static boolean copy(FileSystem srcFS, FileStatus srcStatus, in = awaitFuture(srcFS.openFile(src) .opt(FS_OPTION_OPENFILE_READ_POLICY, FS_OPTION_OPENFILE_READ_POLICY_WHOLE_FILE) - .opt(FS_OPTION_OPENFILE_LENGTH, + .optLong(FS_OPTION_OPENFILE_LENGTH, srcStatus.getLen()) // file length hint for object stores .build()); out = dstFS.create(dst, overwrite);