laskoviymishka commented on code in PR #1350:
URL: https://github.com/apache/iceberg-go/pull/1350#discussion_r3539706592


##########
io/gocloud/blob.go:
##########
@@ -368,10 +429,194 @@ func (bfs *blobFileIO) DeleteFiles(ctx context.Context, 
paths []string) ([]strin
        return deleted, errs
 }
 
+// MkdirAll mimics creating a directory by creating a zero-length object for 
each component of the path
+func (bfs *BlobFileIO) MkdirAll(path string) error {
+       key, err := bfs.preprocess(path)
+       if err != nil {
+               return &fs.PathError{Op: "mkdir", Path: path, Err: err}
+       }
+
+       key = strings.Trim(key, "/")
+       if key == "" || key == "." {
+               return nil
+       }
+
+       parts := strings.Split(key, "/")
+       for idx := range parts {

Review Comment:
   This writes a marker for every component including the leaf, so an empty 
namespace ends up with a lone `warehouse/ns/` object. After the tables are 
dropped that marker is all that's left, and `DropNamespace`'s emptiness walk 
sees it as a file entry named `ns` and returns `ErrNamespaceNotEmpty` — so an 
empty blob namespace can never be dropped.
   
   I'd either skip writing the leaf marker here, or have the drop walk skip the 
namespace's own marker. A CreateNamespace→CreateTable→DropTable→DropNamespace 
test would have caught it and nothing currently exercises that path. wdyt?



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to