This is an automated email from the ASF dual-hosted git repository. hanishakoneru pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push: new b3bc94e HDFS-14236. Lazy persist copy/ put fails with ViewFs. b3bc94e is described below commit b3bc94ebfd7cbf959bd33b8d85be80c4a8a46574 Author: Hanisha Koneru <hanishakon...@apache.org> AuthorDate: Tue Jan 29 16:45:44 2019 -0800 HDFS-14236. Lazy persist copy/ put fails with ViewFs. --- .../org/apache/hadoop/fs/shell/CommandWithDestination.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java index 0bd4882..2421f06 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/CommandWithDestination.java @@ -44,6 +44,7 @@ import org.apache.hadoop.fs.PathOperationException; import org.apache.hadoop.fs.permission.AclEntry; import org.apache.hadoop.fs.permission.AclUtil; import org.apache.hadoop.fs.permission.FsPermission; +import org.apache.hadoop.fs.viewfs.NotInMountpointException; import org.apache.hadoop.io.IOUtils; import static org.apache.hadoop.fs.CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_DEFAULT; @@ -494,6 +495,17 @@ abstract class CommandWithDestination extends FsCommand { throws IOException { try { if (lazyPersist) { + long defaultBlockSize; + try { + defaultBlockSize = getDefaultBlockSize(); + } catch (NotInMountpointException ex) { + // ViewFileSystem#getDefaultBlockSize() throws an exception as it + // needs a target FS to retrive the default block size from. + // Hence, for ViewFs, we should call getDefaultBlockSize with the + // target path. + defaultBlockSize = getDefaultBlockSize(item.path); + } + EnumSet<CreateFlag> createFlags = EnumSet.of(CREATE, LAZY_PERSIST); return create(item.path, FsPermission.getFileDefault().applyUMask( @@ -502,7 +514,7 @@ abstract class CommandWithDestination extends FsCommand { getConf().getInt(IO_FILE_BUFFER_SIZE_KEY, IO_FILE_BUFFER_SIZE_DEFAULT), (short) 1, - getDefaultBlockSize(), + defaultBlockSize, null, null); } else { --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org