aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-01-05 22:51:50 -0800
committerChris Lu <chris.lu@gmail.com>2019-01-05 22:51:50 -0800
commitbd32108a90b3403e1fed75c62fa947fa9c0e6cd1 (patch)
tree4cc1007ceecfedeefd9d6d52d1eda94ce49dd456
parentbe9a7592a1ede622659ea7405a1ec23486b577a5 (diff)
downloadseaweedfs-bd32108a90b3403e1fed75c62fa947fa9c0e6cd1.tar.xz
seaweedfs-bd32108a90b3403e1fed75c62fa947fa9c0e6cd1.zip
disable async file deletion
-rw-r--r--weed/filesys/dir.go2
-rw-r--r--weed/filesys/filehandle.go2
-rw-r--r--weed/filesys/wfs_deletion.go24
3 files changed, 20 insertions, 8 deletions
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go
index f8b9a049c..fae289217 100644
--- a/weed/filesys/dir.go
+++ b/weed/filesys/dir.go
@@ -329,7 +329,7 @@ func (dir *Dir) removeOneFile(ctx context.Context, req *fuse.RemoveRequest) erro
return err
}
- dir.wfs.asyncDeleteFileChunks(entry.Chunks)
+ dir.wfs.deleteFileChunks(entry.Chunks)
return dir.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
diff --git a/weed/filesys/filehandle.go b/weed/filesys/filehandle.go
index 23741a052..0f6ca1164 100644
--- a/weed/filesys/filehandle.go
+++ b/weed/filesys/filehandle.go
@@ -220,7 +220,7 @@ func (fh *FileHandle) Flush(ctx context.Context, req *fuse.FlushRequest) error {
chunks, garbages := filer2.CompactFileChunks(fh.f.entry.Chunks)
fh.f.entry.Chunks = chunks
// fh.f.entryViewCache = nil
- fh.f.wfs.asyncDeleteFileChunks(garbages)
+ fh.f.wfs.deleteFileChunks(garbages)
if _, err := client.CreateEntry(ctx, request); err != nil {
return fmt.Errorf("update fh: %v", err)
diff --git a/weed/filesys/wfs_deletion.go b/weed/filesys/wfs_deletion.go
index 45eb68397..f58ef24f4 100644
--- a/weed/filesys/wfs_deletion.go
+++ b/weed/filesys/wfs_deletion.go
@@ -35,12 +35,24 @@ func (wfs *WFS) loopProcessingDeletion() {
}
-func (wfs *WFS) asyncDeleteFileChunks(chunks []*filer_pb.FileChunk) {
- if len(chunks) > 0 {
- var fileIds []string
- for _, chunk := range chunks {
- fileIds = append(fileIds, chunk.FileId)
- }
+func (wfs *WFS) deleteFileChunks(chunks []*filer_pb.FileChunk) {
+ if len(chunks) == 0 {
+ return
+ }
+
+ var fileIds []string
+ for _, chunk := range chunks {
+ fileIds = append(fileIds, chunk.FileId)
+ }
+
+ var async = false
+ if async {
wfs.fileIdsDeletionChan <- fileIds
+ return
}
+
+ wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
+ deleteFileIds(context.Background(), client, fileIds)
+ return nil
+ })
}