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
consolidate file chunks during create
Chris Lu13d6a74eb29b
diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.goindex 6c3390a26a..da506c70a3 100644--- a/weed/server/filer_grpc_server.go+++ b/weed/server/filer_grpc_server.go@@ -125,10 +125,19 @@ func (fs *FilerServer) LookupVolume(ctx context.Context, req *filer_pb.LookupVol}func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntryRequest) (resp *filer_pb.CreateEntryResponse, err error) {++ fullpath := filer2.FullPath(filepath.Join(req.Directory, req.Entry.Name))+ chunks, garbages := filer2.CompactFileChunks(req.Entry.Chunks)++ for _, garbage := range garbages {+ glog.V(0).Infof("deleting %s garbage chunk: %v, [%d, %d)", fullpath, garbage.FileId, garbage.Offset, garbage.Offset+int64(garbage.Size))+ fs.filer.DeleteFileByFileId(garbage.FileId)+ }+err = fs.filer.CreateEntry(&filer2.Entry{- FullPath: filer2.FullPath(filepath.Join(req.Directory, req.Entry.Name)),+ FullPath: fullpath,Attr: filer2.PbToEntryAttribute(req.Entry.Attributes),- Chunks: req.Entry.Chunks,+ Chunks: chunks,})if err == nil {