Dmitriy Pavlov
1 month ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with
11 additions and
2 deletions
-
weed/command/scaffold/master.toml
-
weed/server/master_grpc_server_assign.go
-
weed/server/master_grpc_server_volume.go
-
weed/server/master_server.go
-
weed/server/master_server_handlers.go
|
|
@ -50,6 +50,7 @@ copy_2 = 6 # create 2 x 6 = 12 actual volumes |
|
|
|
copy_3 = 3 # create 3 x 3 = 9 actual volumes |
|
|
|
copy_other = 1 # create n x 1 = n actual volumes |
|
|
|
threshold = 0.9 # create threshold |
|
|
|
disable = false # disables volume growth if true |
|
|
|
|
|
|
|
# configuration flags for replication |
|
|
|
[master.replication] |
|
|
|
|
|
@ -89,7 +89,7 @@ func (ms *MasterServer) Assign(ctx context.Context, req *master_pb.AssignRequest |
|
|
|
|
|
|
|
for time.Now().Sub(startTime) < maxTimeout { |
|
|
|
fid, count, dnList, shouldGrow, err := ms.Topo.PickForWrite(req.Count, option, vl) |
|
|
|
if shouldGrow && !vl.HasGrowRequest() { |
|
|
|
if shouldGrow && !vl.HasGrowRequest() && !ms.option.VolumeGrowthDisabled { |
|
|
|
if err != nil && ms.Topo.AvailableSpaceFor(option) <= 0 { |
|
|
|
err = fmt.Errorf("%s and no free volumes left for %s", err.Error(), option.String()) |
|
|
|
} |
|
|
|
|
|
@ -28,6 +28,10 @@ const ( |
|
|
|
) |
|
|
|
|
|
|
|
func (ms *MasterServer) DoAutomaticVolumeGrow(req *topology.VolumeGrowRequest) { |
|
|
|
if ms.option.VolumeGrowthDisabled { |
|
|
|
glog.V(1).Infof("automatic volume grow disabled") |
|
|
|
return |
|
|
|
} |
|
|
|
glog.V(1).Infoln("starting automatic volume grow") |
|
|
|
start := time.Now() |
|
|
|
newVidLocations, err := ms.vg.AutomaticGrowByType(req.Option, ms.grpcDialOption, ms.Topo, req.Count) |
|
|
|
|
|
@ -57,6 +57,7 @@ type MasterOption struct { |
|
|
|
IsFollower bool |
|
|
|
TelemetryUrl string |
|
|
|
TelemetryEnabled bool |
|
|
|
VolumeGrowthDisabled bool |
|
|
|
} |
|
|
|
|
|
|
|
type MasterServer struct { |
|
|
@ -105,6 +106,9 @@ func NewMasterServer(r *mux.Router, option *MasterOption, peers map[string]pb.Se |
|
|
|
v.SetDefault("master.volume_growth.copy_3", topology.VolumeGrowStrategy.Copy3Count) |
|
|
|
v.SetDefault("master.volume_growth.copy_other", topology.VolumeGrowStrategy.CopyOtherCount) |
|
|
|
v.SetDefault("master.volume_growth.threshold", topology.VolumeGrowStrategy.Threshold) |
|
|
|
v.SetDefault("master.volume_growth.disable", false) |
|
|
|
option.VolumeGrowthDisabled = v.GetBool("master.volume_growth.disable") |
|
|
|
|
|
|
|
topology.VolumeGrowStrategy.Copy1Count = v.GetUint32("master.volume_growth.copy_1") |
|
|
|
topology.VolumeGrowStrategy.Copy2Count = v.GetUint32("master.volume_growth.copy_2") |
|
|
|
topology.VolumeGrowStrategy.Copy3Count = v.GetUint32("master.volume_growth.copy_3") |
|
|
|
|
|
@ -142,7 +142,7 @@ func (ms *MasterServer) dirAssignHandler(w http.ResponseWriter, r *http.Request) |
|
|
|
|
|
|
|
for time.Since(startTime) < maxTimeout { |
|
|
|
fid, count, dnList, shouldGrow, err := ms.Topo.PickForWrite(requestedCount, option, vl) |
|
|
|
if shouldGrow && !vl.HasGrowRequest() { |
|
|
|
if shouldGrow && !vl.HasGrowRequest() && !ms.option.VolumeGrowthDisabled { |
|
|
|
glog.V(0).Infof("dirAssign volume growth %v from %v", option.String(), r.RemoteAddr) |
|
|
|
if err != nil && ms.Topo.AvailableSpaceFor(option) <= 0 { |
|
|
|
err = fmt.Errorf("%s and no free volumes left for %s", err.Error(), option.String()) |
|
|
|