kezhuw commented on a change in pull request #2944:
URL: https://github.com/apache/bookkeeper/pull/2944#discussion_r823266442



##########
File path: 
bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/FileInfo.java
##########
@@ -549,6 +549,7 @@ public synchronized void moveToNewLocation(File newFile, 
long size) throws IOExc
         }
         fc = new RandomAccessFile(newFile, mode).getChannel();
         lf = newFile;
+        deleted = false;

Review comment:
       > `moveToNewLocation` is not expected the be in deleted state at all 
during the rename
   
   
   It is only correct in ideal situation. Could this operation happen cross 
filesystems or even devices ? I think this method make no assumption about 
this. From my side, `delete` in `moveToNewLocation` is more like a conservative 
operation than solely `Files.delete()`(which throw exception on deletion 
failure). After failure of `FileInfo.delete`, `FileInfo` is unusable as 
`FileInfo.fc` is closed and `FileInfo.lf` is not guaranteed to exist.
   
   I have no preference from approaches:
   * Current: `FileInfo.delete()` and throws exception on failure.
   * Alternative: `FileInfo.lf.delete()` and mark `deleted` and throws 
exception on failure.
   
   I think they are identical.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to