@@ -43,6 +43,7 @@ public class CosNFileSystem extends FileSystem {
43
43
private boolean isPosixBucket ;
44
44
private NativeFileSystemStore nativeStore ;
45
45
private boolean isDefaultNativeStore ;
46
+ private boolean isCreateRecursiveCheckDstDir ;
46
47
private Path workingDir ;
47
48
private String owner = "Unknown" ;
48
49
private String group = "Unknown" ;
@@ -120,6 +121,11 @@ public void initialize(URI uri, Configuration conf) throws IOException {
120
121
CosNConfigKeys .READ_AHEAD_QUEUE_SIZE ,
121
122
CosNConfigKeys .DEFAULT_READ_AHEAD_QUEUE_SIZE
122
123
);
124
+
125
+ this .isCreateRecursiveCheckDstDir = this .getConf ().getBoolean (
126
+ CosNConfigKeys .COSN_CREATE_RECURSIVE_CHECK_DST_DIR_ENABLED ,
127
+ CosNConfigKeys .DEFAULT_COSN_CREATE_RECURSIVE_CHECK_DST_DIR_ENABLED
128
+ );
123
129
Preconditions .checkArgument (uploadThreadPoolSize > 0 ,
124
130
String .format ("The uploadThreadPoolSize[%d] should be positive." , uploadThreadPoolSize ));
125
131
Preconditions .checkArgument (readAheadPoolSize > 0 ,
@@ -296,7 +302,9 @@ public FSDataOutputStream create(Path f, FsPermission permission,
296
302
throw new FileAlreadyExistsException ("Directory already exists: " + f );
297
303
}
298
304
} catch (FileNotFoundException e ) {
299
- validatePath (f );
305
+ if (this .isCreateRecursiveCheckDstDir ) {
306
+ validatePath (f );
307
+ }
300
308
}
301
309
302
310
Path absolutePath = makeAbsolute (f );
0 commit comments