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.

delete garbage only when successful

Chris Lu613a2e8060c4
diff --git a/weed/server/filer_grpc_server.go b/weed/server/filer_grpc_server.go
index 1c2d95e1ff..bcac4dbde1 100644
--- a/weed/server/filer_grpc_server.go
+++ b/weed/server/filer_grpc_server.go
@@ -114,8 +114,6 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr
fullpath := filer2.FullPath(filepath.ToSlash(filepath.Join(req.Directory, req.Entry.Name)))
chunks, garbages := filer2.CompactFileChunks(req.Entry.Chunks)
- fs.filer.DeleteChunks(fullpath, garbages)
-
if req.Entry.Attributes == nil {
return nil, fmt.Errorf("can not create entry with empty attributes")
}
@@ -127,6 +125,7 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr
})
if err == nil {
+ fs.filer.DeleteChunks(fullpath, garbages)
}
return &filer_pb.CreateEntryResponse{}, err