From 9f1e0aeef5898db5b121eb0b9f8a70a06844b0e9 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 18 Aug 2020 23:40:53 -0700 Subject: [PATCH] delete chunks in the last step --- weed/filesys/dir.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go index 578c40014..645051821 100644 --- a/weed/filesys/dir.go +++ b/weed/filesys/dir.go @@ -317,8 +317,8 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error { return nil } - dir.wfs.deleteFileChunks(entry.Chunks) + // first, ensure the filer store can correctly delete 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 { @@ -326,9 +326,13 @@ func (dir *Dir) removeOneFile(req *fuse.RemoveRequest) error { return fuse.ENOENT } + // then, delete meta cache and fsNode cache dir.wfs.metaCache.DeleteEntry(context.Background(), filePath) dir.wfs.fsNodeCache.DeleteFsNode(filePath) + // delete the chunks last + dir.wfs.deleteFileChunks(entry.Chunks) + return nil }