mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
disable async file deletion
This commit is contained in:
parent
be9a7592a1
commit
bd32108a90
|
@ -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 {
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
wfs.fileIdsDeletionChan <- fileIds
|
||||
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
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue