aboutsummaryrefslogtreecommitdiff
path: root/weed/server/master_server.go
diff options
context:
space:
mode:
authorqieqieplus <admin@qieqie.me>2021-05-06 18:46:14 +0800
committerqieqieplus <admin@qieqie.me>2021-05-06 18:55:44 +0800
commitc4d32f6937236a83377e3937e311222fc04bd084 (patch)
tree6d803bc4df6d7d889b8ca883d5ad5181502ebe5f /weed/server/master_server.go
parentc48ef786702e4c62f644631d37d31218f7447fe4 (diff)
downloadseaweedfs-c4d32f6937236a83377e3937e311222fc04bd084.tar.xz
seaweedfs-c4d32f6937236a83377e3937e311222fc04bd084.zip
ahead of time volume assignment
Diffstat (limited to 'weed/server/master_server.go')
-rw-r--r--weed/server/master_server.go22
1 files changed, 18 insertions, 4 deletions
diff --git a/weed/server/master_server.go b/weed/server/master_server.go
index e2b2df18d..838803908 100644
--- a/weed/server/master_server.go
+++ b/weed/server/master_server.go
@@ -51,9 +51,9 @@ type MasterServer struct {
preallocateSize int64
- Topo *topology.Topology
- vg *topology.VolumeGrowth
- vgLock sync.Mutex
+ Topo *topology.Topology
+ vg *topology.VolumeGrowth
+ vgCh chan *topology.VolumeGrowRequest
boundedLeaderChan chan int
@@ -82,6 +82,12 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *Maste
v.SetDefault("master.replication.treat_replication_as_minimums", false)
replicationAsMin := v.GetBool("master.replication.treat_replication_as_minimums")
+ v.SetDefault("master.volume_growth.copy_1", 7)
+ v.SetDefault("master.volume_growth.copy_2", 6)
+ v.SetDefault("master.volume_growth.copy_3", 3)
+ v.SetDefault("master.volume_growth.copy_other", 1)
+ v.SetDefault("master.volume_growth.threshold", 0.9)
+
var preallocateSize int64
if option.VolumePreallocate {
preallocateSize = int64(option.VolumeSizeLimitMB) * (1 << 20)
@@ -91,6 +97,7 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *Maste
ms := &MasterServer{
option: option,
preallocateSize: preallocateSize,
+ vgCh: make(chan *topology.VolumeGrowRequest, 1 << 6),
clientChans: make(map[string]chan *master_pb.VolumeLocation),
grpcDialOption: grpcDialOption,
MasterClient: wdclient.NewMasterClient(grpcDialOption, "master", option.Host, 0, "", peers),
@@ -128,7 +135,14 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers []string) *Maste
r.HandleFunc("/{fileId}", ms.redirectHandler)
}
- ms.Topo.StartRefreshWritableVolumes(ms.grpcDialOption, ms.option.GarbageThreshold, ms.preallocateSize)
+ ms.Topo.StartRefreshWritableVolumes(
+ ms.grpcDialOption,
+ ms.option.GarbageThreshold,
+ v.GetFloat64("master.volume_growth.threshold"),
+ ms.preallocateSize,
+ )
+
+ ms.ProcessGrowRequest()
ms.startAdminScripts()