You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2022/08/23 10:39:05 UTC

[GitHub] [ratis] adoroszlai commented on a diff in pull request #720: RATIS-1681. Use atomic_move to enhance robustness

adoroszlai commented on code in PR #720:
URL: https://github.com/apache/ratis/pull/720#discussion_r952445754


##########
ratis-common/src/main/java/org/apache/ratis/util/FileUtils.java:
##########
@@ -77,7 +77,7 @@ static void move(File src, File dst) throws IOException {
 
   static void move(Path src, Path dst) throws IOException {
     LogUtils.runAndLog(LOG,
-        () -> Files.move(src, dst),
+        () -> Files.move(src, dst, StandardCopyOption.ATOMIC_MOVE),

Review Comment:
   According to [javadoc](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Files.html#move-java.nio.file.Path-java.nio.file.Path-java.nio.file.CopyOption...-), this would fail with exception if move cannot be performed as an atomic operation.  If I understand correctly, moving across filesystems is such a non-atomic operation, performed as "copy and delete" instead.
   
   Should we retry without the option in case of `AtomicMoveNotSupportedException`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org