filer: support running multiple mount to different filers avoiding duplicated cache
fix https://github.com/chrislusf/seaweedfs/issues/1382
This commit is contained in:
@@ -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 {
|
if option.CacheSizeMB > 0 {
|
||||||
os.MkdirAll(option.CacheDir, 0755)
|
os.MkdirAll(cacheDir, 0755)
|
||||||
wfs.chunkCache = chunk_cache.NewChunkCache(256, option.CacheDir, option.CacheSizeMB)
|
wfs.chunkCache = chunk_cache.NewChunkCache(256, cacheDir, option.CacheSizeMB)
|
||||||
grace.OnInterrupt(func() {
|
grace.OnInterrupt(func() {
|
||||||
wfs.chunkCache.Shutdown()
|
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()
|
startTime := time.Now()
|
||||||
if err := meta_cache.InitMetaCache(wfs.metaCache, wfs, wfs.option.FilerMountRootPath); err != nil {
|
if err := meta_cache.InitMetaCache(wfs.metaCache, wfs, wfs.option.FilerMountRootPath); err != nil {
|
||||||
glog.V(0).Infof("failed to init meta cache: %v", err)
|
glog.V(0).Infof("failed to init meta cache: %v", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user