Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

collection.delete requires _default_ as the default empty collection name

Chris Lu3d47c38262c6
diff --git a/weed/shell/command_collection_delete.go b/weed/shell/command_collection_delete.go
index 5777d57802..e43f2a0939 100644
--- a/weed/shell/command_collection_delete.go
+++ b/weed/shell/command_collection_delete.go
@@ -34,14 +34,22 @@ func (c *commandCollectionDelete) Do(args []string, commandEnv *CommandEnv, writ
}
colDeleteCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
- collectionName := colDeleteCommand.String("collection", "", "collection to delete")
+ collectionName := colDeleteCommand.String("collection", "", "collection to delete. Use '_default_' for the empty-named collection.")
applyBalancing := colDeleteCommand.Bool("force", false, "apply the collection")
if err = colDeleteCommand.Parse(args); err != nil {
return nil
}
+ if *collectionName == "" {
+ return fmt.Errorf("empty collection name is not allowed")
+ }
+
+ if *collectionName == "_default_" {
+ *collectionName = ""
+ }
+
if !*applyBalancing {
- fmt.Fprintf(writer, "collection %s will be deleted. Use -force to apply the change.\n", *collectionName)
+ fmt.Fprintf(writer, "collection '%s' will be deleted. Use -force to apply the change.\n", *collectionName)
return nil
}