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/22 08:14:41 UTC

[GitHub] [ratis] SzyWilliam opened a new pull request, #720: RATIS-1681. Use atomic_move to enhance robustness

SzyWilliam opened a new pull request, #720:
URL: https://github.com/apache/ratis/pull/720

   ## What changes were proposed in this pull request?
   
   Use StandardCopyOption.ATOMIC_MOVE to enhance robustness.
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/RATIS-1681
   
   ## How was this patch tested?
   unit tests
   


-- 
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


[GitHub] [ratis] szetszwo merged pull request #720: RATIS-1681. Use atomic_move to enhance robustness

Posted by GitBox <gi...@apache.org>.
szetszwo merged PR #720:
URL: https://github.com/apache/ratis/pull/720


-- 
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


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

Posted by GitBox <gi...@apache.org>.
adoroszlai commented on code in PR #720:
URL: https://github.com/apache/ratis/pull/720#discussion_r952749961


##########
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:
   Thanks for updating the patch, LGTM.



-- 
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


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

Posted by GitBox <gi...@apache.org>.
SzyWilliam commented on code in PR #720:
URL: https://github.com/apache/ratis/pull/720#discussion_r952729705


##########
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:
   Thanks for your review! Indeed we may encounter cross disk move, so I'll add the fallback retry logic.



-- 
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


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

Posted by GitBox <gi...@apache.org>.
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