aboutsummaryrefslogtreecommitdiff
path: root/weed/server/master_server.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2024-04-18 09:09:45 -0700
committerchrislu <chris.lu@gmail.com>2024-04-18 09:09:45 -0700
commit55976ae04a225a4c440e6422891ba11d19df1bfd (patch)
tree2bbe28ac70f044d575763b87136651a22acee0c8 /weed/server/master_server.go
parent31f1f960386ef1ad10fa5301e88e19c88e3756c1 (diff)
downloadseaweedfs-55976ae04a225a4c440e6422891ba11d19df1bfd.tar.xz
seaweedfs-55976ae04a225a4c440e6422891ba11d19df1bfd.zip
avoid repeated calls to heavy-weighted viper
Diffstat (limited to 'weed/server/master_server.go')
-rw-r--r--weed/server/master_server.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/weed/server/master_server.go b/weed/server/master_server.go
index a2f3c7692..f89c9598f 100644
--- a/weed/server/master_server.go
+++ b/weed/server/master_server.go
@@ -97,6 +97,11 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers map[string]pb.Se
v.SetDefault("master.volume_growth.copy_3", 3)
v.SetDefault("master.volume_growth.copy_other", 1)
v.SetDefault("master.volume_growth.threshold", 0.9)
+ topology.VolumeGrowStrategy.Copy1Count = v.GetInt("master.volume_growth.copy_1")
+ topology.VolumeGrowStrategy.Copy2Count = v.GetInt("master.volume_growth.copy_2")
+ topology.VolumeGrowStrategy.Copy3Count = v.GetInt("master.volume_growth.copy_3")
+ topology.VolumeGrowStrategy.CopyOtherCount = v.GetInt("master.volume_growth.copy_other")
+ topology.VolumeGrowStrategy.Threshold = v.GetFloat64("master.volume_growth.threshold")
var preallocateSize int64
if option.VolumePreallocate {
@@ -151,7 +156,7 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers map[string]pb.Se
ms.Topo.StartRefreshWritableVolumes(
ms.grpcDialOption,
ms.option.GarbageThreshold,
- v.GetFloat64("master.volume_growth.threshold"),
+ topology.VolumeGrowStrategy.Threshold,
ms.preallocateSize,
)