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.

ignore duplicated key error if the store has duplicated primary key prevention

Chris Lu56a5d5af8d62
diff --git a/weed/filer2/filer.go b/weed/filer2/filer.go
index 2586c664c2..d722e60ac5 100644
--- a/weed/filer2/filer.go
+++ b/weed/filer2/filer.go
@@ -88,11 +88,13 @@ func (f *Filer) CreateEntry(entry *Entry) error {
glog.V(2).Infof("create directory: %s %v", dirPath, dirEntry.Mode)
mkdirErr := f.store.InsertEntry(dirEntry)
if mkdirErr != nil {
- return fmt.Errorf("mkdir %s: %v", dirPath, mkdirErr)
+ if _, err := f.FindEntry(FullPath(dirPath)); err == ErrNotFound {
+ return fmt.Errorf("mkdir %s: %v", dirPath, mkdirErr)
+ }
+ } else {
+ f.NotifyUpdateEvent(nil, dirEntry, false)
}
- f.NotifyUpdateEvent(nil, dirEntry, false)
-
} else if !dirEntry.IsDirectory() {
return fmt.Errorf("%s is a file", dirPath)
}