felixcheung commented on a change in pull request #3428: [ZEPPELIN-4305]
LocalStorageConfig.atomicWriteToFile throws exception
URL: https://github.com/apache/zeppelin/pull/3428#discussion_r315028921
##########
File path:
zeppelin-zengine/src/main/java/org/apache/zeppelin/storage/LocalConfigStorage.java
##########
@@ -123,8 +123,9 @@ private void atomicWriteToFile(String content, File file)
throws IOException {
Path destinationFilePath =
defaultFileSystem.getPath(file.getCanonicalPath());
try {
file.getParentFile().mkdirs();
- Files.move(tempFile.toPath(), destinationFilePath,
- StandardCopyOption.ATOMIC_MOVE);
+ Path tempDestinationFile =
defaultFileSystem.getPath(file.getCanonicalPath() + ".tmp");
+ Files.move(tempFile.toPath(), tempDestinationFile);
Review comment:
this extra file operation can be costly in some storage system?
also if the operation fails we need to clean up an extra file? L131 for
example
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services