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 7152f02d3a6..65e52fd3b0b 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 @@ -473,19 +473,20 @@ abstract class CommandWithDestination extends FsCommand { FSDataOutputStream create(PathData item, boolean lazyPersist) throws IOException { try { - EnumSet createFlags = EnumSet.of(CREATE); if (lazyPersist) { - createFlags.add(LAZY_PERSIST); + EnumSet createFlags = EnumSet.of(CREATE, LAZY_PERSIST); + return create(item.path, + FsPermission.getFileDefault().applyUMask( + FsPermission.getUMask(getConf())), + createFlags, + getConf().getInt("io.file.buffer.size", 4096), + lazyPersist ? 1 : getDefaultReplication(item.path), + getDefaultBlockSize(), + null, + null); + } else { + return create(item.path, true); } - return create(item.path, - FsPermission.getFileDefault().applyUMask( - FsPermission.getUMask(getConf())), - createFlags, - getConf().getInt("io.file.buffer.size", 4096), - lazyPersist ? 1 : getDefaultReplication(item.path), - getDefaultBlockSize(), - null, - null); } finally { // might have been created but stream was interrupted deleteOnExit(item.path); } diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-6581.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-6581.txt index f6c8672b1d5..e1f51c1b176 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-6581.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-6581.txt @@ -50,4 +50,6 @@ HDFS-7064. Fix unit test failures in HDFS-6581 branch. (Xiaoyu Yao via Arpit Agarwal) + HDFS-6581. Few more unit test fixes for HDFS-6581. (Arpit Agarwal) +