Xuanwo commented on code in PR #6326:
URL: https://github.com/apache/opendal/pull/6326#discussion_r2160224892


##########
core/src/services/fs/core.rs:
##########
@@ -119,9 +119,12 @@ impl FsCore {
     ) -> Result<(PathBuf, Option<PathBuf>)> {
         if let Some(atomic_write_dir) = &self.atomic_write_dir {
             let target_path = self.ensure_write_abs_path(&self.root, 
path).await?;
-            let tmp_path = self
-                .ensure_write_abs_path(atomic_write_dir, 
&build_tmp_path_of(path))
-                .await?;
+            let path = if op.if_not_exists() {
+                target_path.to_string_lossy().to_string()

Review Comment:
   Hi, this could be logically incorrect since `atomic_write_dir` is meant to 
ensure our write operation is atomic. Even if the target path is empty, we 
still need to write to the temporary path first.
   
   I think that in the case of `atomic_write_dir`, it's unavoidable to call 
`try_exists` first. The logic here is somewhat complex, so perhaps we should 
consider a major refactor.



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