summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@verizonmedia.com>2019-10-08 09:21:56 +0200
committerHåkon Hallingstad <hakon@verizonmedia.com>2019-10-08 09:21:56 +0200
commit0b8ab807832e8e18e2762caefd76e366fc17e5ab (patch)
treee2956d4d58e2f6bd39d860b4411739c080bc79ea
parent09a59e25ad2bc2b1e378c8e059e2a8be80f0aac5 (diff)
Add REPLACE_EXISTING for atomic moves
If the destination file exists for an atomic move, then JimFs throws a java.nio.file.FileAlreadyExistsException exception. The documentation for Files.move() says "all other options are ignored" with ATOMIC_MOVE, so this seems to be a bug with JimFs. UnixFileSystemProvider correctly ignores other options with ATOMIC_MOVE.
-rw-r--r--node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPath.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPath.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPath.java
index 2cc74742463..de3555b24a5 100644
--- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPath.java
+++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/file/UnixPath.java
@@ -206,7 +206,7 @@ public class UnixPath {
/** This path must be on the same file system as the to-path. Returns UnixPath of 'to'. */
public UnixPath atomicMove(Path to) {
- uncheck(() -> Files.move(path, to, StandardCopyOption.ATOMIC_MOVE));
+ uncheck(() -> Files.move(path, to, StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING));
return new UnixPath(to);
}