Browse Source

HDFS-7079. Few more unit test fixes for HDFS-6581. (Arpit Agarwal)

Conflicts:
	hadoop-hdfs-project/hadoop-hdfs/CHANGES-HDFS-6581.txt
arp 10 years ago
parent
commit
e4ef0023b8

+ 12 - 11
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<CreateFlag> createFlags = EnumSet.of(CREATE);
         if (lazyPersist) {
-          createFlags.add(LAZY_PERSIST);
+          EnumSet<CreateFlag> 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);
       }