szetszwo commented on code in PR #1237:
URL: https://github.com/apache/ratis/pull/1237#discussion_r1999037447


##########
ratis-common/src/main/java/org/apache/ratis/util/AtomicFileOutputStream.java:
##########
@@ -60,7 +60,7 @@ public AtomicFileOutputStream(File outFile) throws 
IOException {
   }
 
   public AtomicFileOutputStream(File outFile, File tmpFile) throws IOException 
{
-    super(FileUtils.newOutputStreamForceAtClose(tmpFile, 
StandardOpenOption.CREATE, StandardOpenOption.WRITE));
+    super(FileUtils.newOutputStreamForceAtClose(tmpFile, 
StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE));

Review Comment:
   Let's pass a createNew parameter.  Usually, we don't care about overwriting 
tmp file since it is just tmp.  On the other hand, we don't want to throw an 
exception when server starting because of a leftover tmp file.  The leftover 
tmp file may be due to killing the previous run.



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