mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-02-09 09:17:28 +08:00
adjust caching and notification for recursive directory deletion
This commit is contained in:
@@ -73,6 +73,8 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry
|
|||||||
var dirChunks []*filer_pb.FileChunk
|
var dirChunks []*filer_pb.FileChunk
|
||||||
if sub.IsDirectory() {
|
if sub.IsDirectory() {
|
||||||
dirChunks, err = f.doBatchDeleteFolderMetaAndData(ctx, sub, isRecursive, ignoreRecursiveError, shouldDeleteChunks)
|
dirChunks, err = f.doBatchDeleteFolderMetaAndData(ctx, sub, isRecursive, ignoreRecursiveError, shouldDeleteChunks)
|
||||||
|
f.cacheDelDirectory(string(sub.FullPath))
|
||||||
|
f.NotifyUpdateEvent(sub, nil, shouldDeleteChunks)
|
||||||
chunks = append(chunks, dirChunks...)
|
chunks = append(chunks, dirChunks...)
|
||||||
} else {
|
} else {
|
||||||
chunks = append(chunks, sub.Chunks...)
|
chunks = append(chunks, sub.Chunks...)
|
||||||
@@ -87,14 +89,11 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
f.cacheDelDirectory(string(entry.FullPath))
|
|
||||||
|
|
||||||
glog.V(3).Infof("deleting directory %v delete %d chunks: %v", entry.FullPath, len(chunks), shouldDeleteChunks)
|
glog.V(3).Infof("deleting directory %v delete %d chunks: %v", entry.FullPath, len(chunks), shouldDeleteChunks)
|
||||||
|
|
||||||
if storeDeletionErr := f.store.DeleteFolderChildren(ctx, entry.FullPath); storeDeletionErr != nil {
|
if storeDeletionErr := f.store.DeleteFolderChildren(ctx, entry.FullPath); storeDeletionErr != nil {
|
||||||
return nil, fmt.Errorf("filer store delete: %v", storeDeletionErr)
|
return nil, fmt.Errorf("filer store delete: %v", storeDeletionErr)
|
||||||
}
|
}
|
||||||
f.NotifyUpdateEvent(entry, nil, shouldDeleteChunks)
|
|
||||||
|
|
||||||
return chunks, nil
|
return chunks, nil
|
||||||
}
|
}
|
||||||
@@ -106,6 +105,9 @@ func (f *Filer) doDeleteEntryMetaAndData(ctx context.Context, entry *Entry, shou
|
|||||||
if storeDeletionErr := f.store.DeleteEntry(ctx, entry.FullPath); storeDeletionErr != nil {
|
if storeDeletionErr := f.store.DeleteEntry(ctx, entry.FullPath); storeDeletionErr != nil {
|
||||||
return fmt.Errorf("filer store delete: %v", storeDeletionErr)
|
return fmt.Errorf("filer store delete: %v", storeDeletionErr)
|
||||||
}
|
}
|
||||||
|
if entry.IsDirectory() {
|
||||||
|
f.cacheDelDirectory(string(entry.FullPath))
|
||||||
|
}
|
||||||
f.NotifyUpdateEvent(entry, nil, shouldDeleteChunks)
|
f.NotifyUpdateEvent(entry, nil, shouldDeleteChunks)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user