aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lu <chrislusf@users.noreply.github.com>2018-07-12 01:17:32 -0700
committerGitHub <noreply@github.com>2018-07-12 01:17:32 -0700
commit9e974f6a1b6c0c1b3c7f21218e5cecaa3f0a96c7 (patch)
treed19b6b12ca9e79ae96b24b275f36c48679b62e60
parentcf5739946bd790677de1ee03d9da438493476189 (diff)
parentc523bc4f07d81e58f53d0355d1e5c3e365ffc4ce (diff)
downloadseaweedfs-9e974f6a1b6c0c1b3c7f21218e5cecaa3f0a96c7.tar.xz
seaweedfs-9e974f6a1b6c0c1b3c7f21218e5cecaa3f0a96c7.zip
Merge pull request #686 from qszxnp/filer2_dir_cache_bugfix
bugfix:delete Directory cache when filer2 delete Directory
-rw-r--r--weed/filer2/filer.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/weed/filer2/filer.go b/weed/filer2/filer.go
index 9c4dd8324..a98194bc8 100644
--- a/weed/filer2/filer.go
+++ b/weed/filer2/filer.go
@@ -139,6 +139,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 {
@@ -155,6 +156,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