filer: DeleteFolderChildren for deleting large folders

This commit is contained in:
Chris Lu
2019-12-13 00:23:05 -08:00
parent 0fa1269bc7
commit bbb6ebc3c0
22 changed files with 311 additions and 402 deletions

View File

@@ -51,9 +51,8 @@ func (f *Filer) loopProcessingDeletion() {
}
}
func (f *Filer) DeleteChunks(fullpath FullPath, chunks []*filer_pb.FileChunk) {
func (f *Filer) DeleteChunks(chunks []*filer_pb.FileChunk) {
for _, chunk := range chunks {
glog.V(3).Infof("deleting %s chunk %s", fullpath, chunk.String())
f.fileIdDeletionChan <- chunk.GetFileIdString()
}
}
@@ -70,7 +69,7 @@ func (f *Filer) deleteChunksIfNotNew(oldEntry, newEntry *Entry) {
return
}
if newEntry == nil {
f.DeleteChunks(oldEntry.FullPath, oldEntry.Chunks)
f.DeleteChunks(oldEntry.Chunks)
}
var toDelete []*filer_pb.FileChunk
@@ -84,5 +83,5 @@ func (f *Filer) deleteChunksIfNotNew(oldEntry, newEntry *Entry) {
toDelete = append(toDelete, oldChunk)
}
}
f.DeleteChunks(oldEntry.FullPath, toDelete)
f.DeleteChunks(toDelete)
}