SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
fix when volume growth are partial successful in automatic mode
Chris Lu63ebafa113d0
diff --git a/go/replication/volume_growth.go b/go/replication/volume_growth.goindex 6b3030293e..d5950790dc 100644--- a/go/replication/volume_growth.go+++ b/go/replication/volume_growth.go@@ -32,22 +32,34 @@ func NewDefaultVolumeGrowth() *VolumeGrowth {return &VolumeGrowth{copy1factor: 7, copy2factor: 6, copy3factor: 3}}-func (vg *VolumeGrowth) GrowByType(repType storage.ReplicationType, dataCenter string, topo *topology.Topology) (int, error) {+func (vg *VolumeGrowth) AutomaticGrowByType(repType storage.ReplicationType, dataCenter string, topo *topology.Topology) (count int, err error) {+ factor := 1switch repType {case storage.Copy000:- return vg.GrowByCountAndType(vg.copy1factor, repType, dataCenter, topo)+ factor = 1+ count, err = vg.GrowByCountAndType(vg.copy1factor, repType, dataCenter, topo)case storage.Copy001:- return vg.GrowByCountAndType(vg.copy2factor, repType, dataCenter, topo)+ factor = 2+ count, err = vg.GrowByCountAndType(vg.copy2factor, repType, dataCenter, topo)case storage.Copy010:- return vg.GrowByCountAndType(vg.copy2factor, repType, dataCenter, topo)+ factor = 2+ count, err = vg.GrowByCountAndType(vg.copy2factor, repType, dataCenter, topo)case storage.Copy100:- return vg.GrowByCountAndType(vg.copy2factor, repType, dataCenter, topo)+ factor = 2+ count, err = vg.GrowByCountAndType(vg.copy2factor, repType, dataCenter, topo)case storage.Copy110:- return vg.GrowByCountAndType(vg.copy3factor, repType, dataCenter, topo)+ factor = 3+ count, err = vg.GrowByCountAndType(vg.copy3factor, repType, dataCenter, topo)case storage.Copy200:- return vg.GrowByCountAndType(vg.copy3factor, repType, dataCenter, topo)+ factor = 3+ count, err = vg.GrowByCountAndType(vg.copy3factor, repType, dataCenter, topo)+ default:+ err = errors.New("Unknown Replication Type!")}- return 0, errors.New("Unknown Replication Type!")+ if count > 0 && count%factor == 0 {+ return count, nil+ }+ return count, err}func (vg *VolumeGrowth) GrowByCountAndType(count int, repType storage.ReplicationType, dataCenter string, topo *topology.Topology) (counter int, err error) {vg.accessLock.Lock()diff --git a/go/weed/master.go b/go/weed/master.goindex a37a8df5aa..5ed3c43fdf 100644--- a/go/weed/master.go+++ b/go/weed/master.go@@ -91,7 +91,7 @@ func dirAssignHandler(w http.ResponseWriter, r *http.Request) {writeJsonQuiet(w, r, map[string]string{"error": "No free volumes left!"})return} else {- if _, err = vg.GrowByType(rt, dataCenter, topo); err != nil {+ if _, err = vg.AutomaticGrowByType(rt, dataCenter, topo); err != nil {writeJsonQuiet(w, r, map[string]string{"error": "Cannot grow volume group! " + err.Error()})return}