flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tillrohrmann <...@git.apache.org>
Subject [GitHub] flink pull request #6243: [FLINK-9707] Support concurrent directory creation...
Date Wed, 04 Jul 2018 06:01:10 GMT
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/6243#discussion_r200015421
  
    --- Diff: flink-core/src/main/java/org/apache/flink/core/fs/local/LocalFileSystem.java
---
    @@ -254,7 +254,7 @@ else if (file.exists() && !file.isDirectory()) {
     		}
     		else {
     			File parent = file.getParentFile();
    -			return (parent == null || mkdirsInternal(parent)) && file.mkdir();
    +			return (parent == null || mkdirsInternal(parent)) && (file.mkdir() || file.isDirectory());
    --- End diff --
    
    The case we want to guard against is that another process created the directory `file`
just before calling `file.mkdir`. In this case, `file.mkdir` would return `false`. Therefore,
we need to check whether the created `file` is really a directory. If this is the case, then
we should return `true` because the directory was created.


---

Mime
View raw message