|
|
@ -145,8 +145,23 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) |
|
|
|
if len(option.Masters.GetInstances()) == 0 { |
|
|
|
glog.Fatal("master list is required!") |
|
|
|
} |
|
|
|
|
|
|
|
if !util.LoadConfiguration("filer", false) { |
|
|
|
v.SetDefault("leveldb2.enabled", true) |
|
|
|
v.SetDefault("leveldb2.dir", option.DefaultLevelDbDir) |
|
|
|
_, err := os.Stat(option.DefaultLevelDbDir) |
|
|
|
if os.IsNotExist(err) { |
|
|
|
os.MkdirAll(option.DefaultLevelDbDir, 0755) |
|
|
|
} |
|
|
|
glog.V(0).Infof("default to create filer store dir in %s", option.DefaultLevelDbDir) |
|
|
|
} else { |
|
|
|
glog.Warningf("skipping default store dir in %s", option.DefaultLevelDbDir) |
|
|
|
} |
|
|
|
util.LoadConfiguration("notification", false) |
|
|
|
|
|
|
|
v.SetDefault("filer.options.max_file_name_length", 255) |
|
|
|
maxFilenameLength := v.GetUint32("filer.options.max_file_name_length") |
|
|
|
glog.V(0).Infof("max_file_name_length %d", maxFilenameLength) |
|
|
|
fs.filer = filer.NewFiler(*option.Masters, fs.grpcDialOption, option.Host, option.FilerGroup, option.Collection, option.DefaultReplication, option.DataCenter, maxFilenameLength, func() { |
|
|
|
if atomic.LoadInt64(&fs.listenersWaits) > 0 { |
|
|
|
fs.listenersCond.Broadcast() |
|
|
@ -162,19 +177,6 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption) |
|
|
|
go stats.LoopPushingMetric("filer", string(fs.option.Host), fs.metricsAddress, fs.metricsIntervalSec) |
|
|
|
go fs.filer.KeepMasterClientConnected(context.Background()) |
|
|
|
|
|
|
|
if !util.LoadConfiguration("filer", false) { |
|
|
|
v.SetDefault("leveldb2.enabled", true) |
|
|
|
v.SetDefault("leveldb2.dir", option.DefaultLevelDbDir) |
|
|
|
_, err := os.Stat(option.DefaultLevelDbDir) |
|
|
|
if os.IsNotExist(err) { |
|
|
|
os.MkdirAll(option.DefaultLevelDbDir, 0755) |
|
|
|
} |
|
|
|
glog.V(0).Infof("default to create filer store dir in %s", option.DefaultLevelDbDir) |
|
|
|
} else { |
|
|
|
glog.Warningf("skipping default store dir in %s", option.DefaultLevelDbDir) |
|
|
|
} |
|
|
|
util.LoadConfiguration("notification", false) |
|
|
|
|
|
|
|
fs.option.recursiveDelete = v.GetBool("filer.options.recursive_delete") |
|
|
|
v.SetDefault("filer.options.buckets_folder", "/buckets") |
|
|
|
fs.filer.DirBucketsPath = v.GetString("filer.options.buckets_folder") |
|
|
|