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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
proper deletion ordering
Chris Lu5b43bddf20cb
diff --git a/weed/filer2/filer_delete_entry.go b/weed/filer2/filer_delete_entry.goindex a528f91521..d6a72e8308 100644--- a/weed/filer2/filer_delete_entry.go+++ b/weed/filer2/filer_delete_entry.go@@ -65,6 +65,7 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry}if lastFileName == "" && !isRecursive && len(entries) > 0 {// only for first iteration in the loop+ glog.Errorf("deleting a folder %s has children: %+v", entry.FullPath, entries)return nil, fmt.Errorf("fail to delete non-empty folder: %s", entry.FullPath)}diff --git a/weed/filesys/dir.go b/weed/filesys/dir.goindex 818e85fd68..50ca6df5df 100644--- a/weed/filesys/dir.go+++ b/weed/filesys/dir.go@@ -218,7 +218,7 @@ func (dir *Dir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, errfunc (dir *Dir) Lookup(ctx context.Context, req *fuse.LookupRequest, resp *fuse.LookupResponse) (node fs.Node, err error) {- glog.V(4).Infof("dir Lookup %s: %s by %s", dir.FullPath(), req.Name, req.Header.String())+ glog.V(5).Infof("dir Lookup %s: %s by %s", dir.FullPath(), req.Name, req.Header.String())fullFilePath := util.NewFullPath(dir.FullPath(), req.Name)dirPath := util.FullPath(dir.FullPath())@@ -316,10 +316,6 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {dir.wfs.deleteFileChunks(entry.Chunks)- dir.wfs.fsNodeCache.DeleteFsNode(filePath)-- dir.wfs.metaCache.DeleteEntry(context.Background(), filePath)-glog.V(3).Infof("remove file: %v", req)err = filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, false, false, false, false)if err != nil {@@ -327,27 +323,29 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error {return fuse.ENOENT}+ dir.wfs.metaCache.DeleteEntry(context.Background(), filePath)+ dir.wfs.fsNodeCache.DeleteFsNode(filePath)+return nil}func (dir *Dir) removeFolder(req *fuse.RemoveRequest) error {- t := util.NewFullPath(dir.FullPath(), req.Name)- dir.wfs.fsNodeCache.DeleteFsNode(t)-- dir.wfs.metaCache.DeleteEntry(context.Background(), t)-glog.V(3).Infof("remove directory entry: %v", req)err := filer_pb.Remove(dir.wfs, dir.FullPath(), req.Name, true, false, false, false)if err != nil {- glog.V(3).Infof("remove %s/%s: %v", dir.FullPath(), req.Name, err)+ glog.V(0).Infof("remove %s/%s: %v", dir.FullPath(), req.Name, err)if strings.Contains(err.Error(), "non-empty"){return fuse.EEXIST}return fuse.ENOENT}+ t := util.NewFullPath(dir.FullPath(), req.Name)+ dir.wfs.metaCache.DeleteEntry(context.Background(), t)+ dir.wfs.fsNodeCache.DeleteFsNode(t)+return nil}