mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-09-14 13:00:38 +02:00
delete garbage only when successful
This commit is contained in:
parent
11be0b5e91
commit
613a2e8060
|
@ -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)))
|
fullpath := filer2.FullPath(filepath.ToSlash(filepath.Join(req.Directory, req.Entry.Name)))
|
||||||
chunks, garbages := filer2.CompactFileChunks(req.Entry.Chunks)
|
chunks, garbages := filer2.CompactFileChunks(req.Entry.Chunks)
|
||||||
|
|
||||||
fs.filer.DeleteChunks(fullpath, garbages)
|
|
||||||
|
|
||||||
if req.Entry.Attributes == nil {
|
if req.Entry.Attributes == nil {
|
||||||
return nil, fmt.Errorf("can not create entry with empty attributes")
|
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 {
|
if err == nil {
|
||||||
|
fs.filer.DeleteChunks(fullpath, garbages)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &filer_pb.CreateEntryResponse{}, err
|
return &filer_pb.CreateEntryResponse{}, err
|
||||||
|
|
Loading…
Reference in a new issue