diff options
| author | 聂鹏 <niepeng@fengbangleasing.com> | 2018-07-11 21:27:25 -0400 |
|---|---|---|
| committer | 聂鹏 <niepeng@fengbangleasing.com> | 2018-07-11 21:27:25 -0400 |
| commit | c523bc4f07d81e58f53d0355d1e5c3e365ffc4ce (patch) | |
| tree | 7e689ea426e71c1ab90b5d7f6fe4f5e1c1b30533 | |
| parent | 2fd48df9d9b8dba87ffd3c811a315dccdd321017 (diff) | |
| download | seaweedfs-c523bc4f07d81e58f53d0355d1e5c3e365ffc4ce.tar.xz seaweedfs-c523bc4f07d81e58f53d0355d1e5c3e365ffc4ce.zip | |
bugfix:delete Directory cache when filer2 delete Directory
| -rw-r--r-- | weed/filer2/filer.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/weed/filer2/filer.go b/weed/filer2/filer.go index 53de5bea3..2d7eaf097 100644 --- a/weed/filer2/filer.go +++ b/weed/filer2/filer.go @@ -137,6 +137,7 @@ func (f *Filer) DeleteEntryMetaAndData(p FullPath, shouldDeleteChunks bool) (err if len(entries) > 0 { return fmt.Errorf("folder %s is not empty", p) } + f.cacheDelDirectory(string(p)) } if shouldDeleteChunks { @@ -153,6 +154,14 @@ func (f *Filer) ListDirectoryEntries(p FullPath, startFileName string, inclusive return f.store.ListDirectoryEntries(p, startFileName, inclusive, limit) } +func (f *Filer) cacheDelDirectory(dirpath string) { + if f.directoryCache == nil { + return + } + f.directoryCache.Delete(dirpath) + return +} + func (f *Filer) cacheGetDirectory(dirpath string) *Entry { if f.directoryCache == nil { return nil |
