diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-04-05 15:03:25 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-04-05 15:03:25 -0700 |
| commit | f71b855db580755d700cbbaf97a3a10737e8fd57 (patch) | |
| tree | d4c86a1617de4399745d1b2455677bf8418d14f3 | |
| parent | f14b6a09a8e57f7513af67381a57e975a00dcad6 (diff) | |
| download | seaweedfs-f71b855db580755d700cbbaf97a3a10737e8fd57.tar.xz seaweedfs-f71b855db580755d700cbbaf97a3a10737e8fd57.zip | |
adjust caching and notification for recursive directory deletion
| -rw-r--r-- | weed/filer2/filer_delete_entry.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/weed/filer2/filer_delete_entry.go b/weed/filer2/filer_delete_entry.go index e90c97c12..2fb53c579 100644 --- a/weed/filer2/filer_delete_entry.go +++ b/weed/filer2/filer_delete_entry.go @@ -73,6 +73,8 @@ func (f *Filer) doBatchDeleteFolderMetaAndData(ctx context.Context, entry *Entry var dirChunks []*filer_pb.FileChunk if sub.IsDirectory() { dirChunks, err = f.doBatchDeleteFolderMetaAndData(ctx, sub, isRecursive, ignoreRecursiveError, shouldDeleteChunks) + f.cacheDelDirectory(string(sub.FullPath)) + f.NotifyUpdateEvent(sub, nil, shouldDeleteChunks) chunks = append(chunks, dirChunks...) } else { 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) if storeDeletionErr := f.store.DeleteFolderChildren(ctx, entry.FullPath); storeDeletionErr != nil { return nil, fmt.Errorf("filer store delete: %v", storeDeletionErr) } - f.NotifyUpdateEvent(entry, nil, shouldDeleteChunks) 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 { return fmt.Errorf("filer store delete: %v", storeDeletionErr) } + if entry.IsDirectory() { + f.cacheDelDirectory(string(entry.FullPath)) + } f.NotifyUpdateEvent(entry, nil, shouldDeleteChunks) return nil |
