tustvold commented on code in PR #5094:
URL: https://github.com/apache/arrow-rs/pull/5094#discussion_r1398330549


##########
object_store/src/local.rs:
##########
@@ -341,10 +341,13 @@ impl ObjectStore for LocalFileSystem {
 
             let err = match file.write_all(&bytes) {
                 Ok(_) => match opts.mode {
-                    PutMode::Overwrite => match std::fs::rename(&staging_path, 
&path) {
-                        Ok(_) => None,
-                        Err(source) => Some(Error::UnableToRenameFile { source 
}),
-                    },
+                    PutMode::Overwrite => {
+                        std::mem::drop(file);
+                        match std::fs::rename(&staging_path, &path) {
+                            Ok(_) => None,
+                            Err(source) => Some(Error::UnableToRenameFile { 
source }),
+                        }
+                    }
                     PutMode::Create => match std::fs::hard_link(&staging_path, 
&path) {

Review Comment:
   Does this behave correctly on blobfuse, I'm not sure it does



##########
object_store/src/local.rs:
##########
@@ -368,7 +371,7 @@ impl ObjectStore for LocalFileSystem {
                 return Err(err.into());
             }
 
-            let metadata = file.metadata().map_err(|e| Error::Metadata {
+            let metadata = metadata(&path).map_err(|e| Error::Metadata {

Review Comment:
   This is now racy in the event of a concurrent put



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