mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-04 19:17:46 +01:00
master: grow rack-spanning volumes once per DC, capped at copy_N (#9835)
* master: grow rack-spanning volumes once per DC, capped at copy_N The periodic rack-aware growth scan grew once per rack. For rack-spanning replication (DiffRackCount > 0) a single logical volume already covers every rack the placement needs, so a crowded volume made every rack report should-grow and the scan created racks×step too many volumes: with "010" across two racks that is 2 racks x step 2 = 4 logical (8 physical) volumes. Plan one DC-wide grow for rack-spanning replication, and cap the per-event step at master.volume_growth.copy_N so lowering it reduces periodic growth. * master: distribute lastGrowCount evenly across uneven DCs The non-rack-spanning grow divisor used the current DC's rack count, so DCs with different rack counts each over-grew. Sum every rack up front and divide lastGrowCount by that global count instead.
This commit is contained in:
1 parent
ab7be7867d
commit
6bd0091c72
4 files changed
+253
-28
No files matched your search
@@ -3,7 +3,6 @@ package weed_server
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
"math/rand/v2"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -89,22 +88,12 @@ func (ms *MasterServer) ProcessGrowRequest() {
|
||||
if err != nil {
|
||||
glog.V(0).Infof("volume grow request failed: %+v", err)
|
||||
}
|
||||
writableVolumes := vl.CloneWritableVolumes()
|
||||
for dcId, racks := range dcs {
|
||||
for _, rackId := range racks {
|
||||
if vl.ShouldGrowVolumesByDcAndRack(&writableVolumes, dcId, rackId) {
|
||||
vgr.DataCenter = string(dcId)
|
||||
vgr.Rack = string(rackId)
|
||||
if lastGrowCount > 0 {
|
||||
vgr.WritableVolumeCount = uint32(math.Ceil(float64(lastGrowCount) / float64(len(dcs)*len(racks))))
|
||||
} else {
|
||||
vgr.WritableVolumeCount = volumeGrowStepCount
|
||||
}
|
||||
|
||||
if _, err = ms.VolumeGrow(ctx, vgr); err != nil {
|
||||
glog.V(0).Infof("volume grow request for dc:%s rack:%s failed: %+v", dcId, rackId, err)
|
||||
}
|
||||
}
|
||||
for _, plan := range vl.PlanRackAwareGrowth(dcs, lastGrowCount, volumeGrowStepCount) {
|
||||
vgr.DataCenter = plan.DataCenter
|
||||
vgr.Rack = plan.Rack
|
||||
vgr.WritableVolumeCount = plan.WritableVolumeCount
|
||||
if _, err = ms.VolumeGrow(ctx, vgr); err != nil {
|
||||
glog.V(0).Infof("volume grow request for dc:%s rack:%s failed: %+v", plan.DataCenter, plan.Rack, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user