diff options
| author | Chris Lu <chris.lu@gmail.com> | 2018-11-20 11:35:08 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2018-11-20 11:35:08 -0800 |
| commit | b318167cd3411b49e142610e11f70cc073ee8382 (patch) | |
| tree | 117d7edb6d8d5dff677c5d41334fac9faee9e436 | |
| parent | 06474e5990a36430541779d09688a4cbf99b6db9 (diff) | |
| download | seaweedfs-b318167cd3411b49e142610e11f70cc073ee8382.tar.xz seaweedfs-b318167cd3411b49e142610e11f70cc073ee8382.zip | |
batch delete file ids
| -rw-r--r-- | weed/filer2/filer.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/weed/filer2/filer.go b/weed/filer2/filer.go index f6f013933..0c0a3e1fa 100644 --- a/weed/filer2/filer.go +++ b/weed/filer2/filer.go @@ -231,9 +231,11 @@ func (f *Filer) cacheSetDirectory(dirpath string, dirEntry *Entry, level int) { } func (f *Filer) DeleteChunks(chunks []*filer_pb.FileChunk) { + var fileIds []string for _, chunk := range chunks { - f.DeleteFileByFileId(chunk.FileId) + fileIds = append(fileIds, chunk.FileId) } + operation.DeleteFiles(f.GetMaster(), fileIds) } func (f *Filer) DeleteFileByFileId(fileId string) { @@ -241,7 +243,7 @@ func (f *Filer) DeleteFileByFileId(fileId string) { if err != nil { glog.V(0).Infof("can not find file %s: %v", fileId, err) } - if _, err := operation.DeleteFilesAtOneVolumeServer(volumeServer, []string{fileId}); err != nil && err != storage.NotFound{ + if _, err := operation.DeleteFilesAtOneVolumeServer(volumeServer, []string{fileId}); err != nil && err != storage.NotFound { glog.V(0).Infof("deleting file %s: %v", fileId, err) } } |
