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
mount: let filer handle chunk deletion decision (#7900)
Chris Lu288ba5fec836
diff --git a/weed/filer/filer_delete_entry.go b/weed/filer/filer_delete_entry.goindex cfe07ec5ae..8b90f8c00b 100644--- a/weed/filer/filer_delete_entry.go+++ b/weed/filer/filer_delete_entry.go@@ -53,7 +53,11 @@ func (f *Filer) DeleteEntryMetaAndData(ctx context.Context, p util.FullPath, isR}if shouldDeleteChunks && !isDeleteCollection {- f.DeleteChunks(ctx, p, entry.GetChunks())+ if len(entry.HardLinkId) != 0 && entry.HardLinkCounter > 1 {+ // if the file is a hard link and there are other hard links, do not delete the chunks+ } else {+ f.DeleteChunks(ctx, p, entry.GetChunks())+ }}if isDeleteCollection {diff --git a/weed/mount/weedfs_file_mkrm.go b/weed/mount/weedfs_file_mkrm.goindex 5734e9df89..4fcaea4fad 100644--- a/weed/mount/weedfs_file_mkrm.go+++ b/weed/mount/weedfs_file_mkrm.go@@ -140,8 +140,9 @@ func (wfs *WFS) Unlink(cancel <-chan struct{}, header *fuse.InHeader, name strin// first, ensure the filer store can correctly deleteglog.V(3).Infof("remove file: %v", entryFullPath)- isDeleteData := entry != nil && entry.HardLinkCounter <= 1- err := filer_pb.Remove(context.Background(), wfs, string(dirFullPath), name, isDeleteData, false, false, false, []int32{wfs.signature})+ // Always let the filer decide whether to delete chunks based on its authoritative data.+ // The filer has the correct hard link count and will only delete chunks when appropriate.+ err := filer_pb.Remove(context.Background(), wfs, string(dirFullPath), name, true, false, false, false, []int32{wfs.signature})if err != nil {glog.V(0).Infof("remove %s: %v", entryFullPath, err)return fuse.OK