diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-07-07 23:18:44 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-07-07 23:18:44 -0700 |
| commit | 54d6b3c30f27e34f5d55827ea54efaf8a95add4f (patch) | |
| tree | 2d3b1abe6ed8a73648c23f0761306d7b9c8668b6 | |
| parent | 4bed1663e265e230a6538c19859396907f419f58 (diff) | |
| download | seaweedfs-54d6b3c30f27e34f5d55827ea54efaf8a95add4f.tar.xz seaweedfs-54d6b3c30f27e34f5d55827ea54efaf8a95add4f.zip | |
filer: support running multiple mount to different filers avoiding duplicated cache
fix https://github.com/chrislusf/seaweedfs/issues/1382
| -rw-r--r-- | weed/filesys/wfs.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index 93f72ad65..8dffa6555 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -84,15 +84,17 @@ func NewSeaweedFileSystem(option *Option) *WFS { }, }, } + cacheUniqueId := util.Md5([]byte(option.FilerGrpcAddress))[0:4] + cacheDir := path.Join(option.CacheDir, cacheUniqueId) if option.CacheSizeMB > 0 { - os.MkdirAll(option.CacheDir, 0755) - wfs.chunkCache = chunk_cache.NewChunkCache(256, option.CacheDir, option.CacheSizeMB) + os.MkdirAll(cacheDir, 0755) + wfs.chunkCache = chunk_cache.NewChunkCache(256, cacheDir, option.CacheSizeMB) grace.OnInterrupt(func() { wfs.chunkCache.Shutdown() }) } - wfs.metaCache = meta_cache.NewMetaCache(path.Join(option.CacheDir, "meta")) + wfs.metaCache = meta_cache.NewMetaCache(path.Join(cacheDir, "meta")) startTime := time.Now() if err := meta_cache.InitMetaCache(wfs.metaCache, wfs, wfs.option.FilerMountRootPath); err != nil { glog.V(0).Infof("failed to init meta cache: %v", err) |
