Xuanwo commented on code in PR #3649:
URL: 
https://github.com/apache/incubator-opendal/pull/3649#discussion_r1401910935


##########
core/src/services/azfile/core.rs:
##########
@@ -413,15 +412,11 @@ impl AzfileCore {
     }
 
     pub async fn ensure_parent_dir_exists(&self, path: &str) -> Result<()> {
-        let mut dirs = VecDeque::default();
         // azure file service does not support recursive directory creation
         let mut p = path;
         while p != "/" {
             p = get_parent(p);
-            dirs.push_front(p);
-        }
-        for dir in dirs {
-            let resp = self.azfile_create_dir(dir).await?;
+            let resp = self.azfile_create_dir(p).await?;

Review Comment:
   Sorry for not make it clear in this issue.
   
   The `check` means sending `azfile_get_path_properties` call before calling 
`azfile_create_dir` to avoid extra API calls.
   
   Take `a/b/c` as an example:
   
   - Check if `a/b/` exist -> No
   - Check if `a/` exist -> No
   - Create `a/`
   - Create `a/b/`
   
   In the best case: if `a/b/` exists, we can avoid two APIs of create_dir.



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