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
Parallelize EC shards balancing within racks (#6354)
Lisandro Pin9b48ce0613ec
diff --git a/weed/shell/command_ec_common.go b/weed/shell/command_ec_common.goindex fff3db429f..c73e342dbb 100644--- a/weed/shell/command_ec_common.go+++ b/weed/shell/command_ec_common.go@@ -786,13 +786,13 @@ func (ecb *ecBalancer) pickRackToBalanceShardsInto(rackToEcNodes map[RackId]*EcRreturn targets[rand.IntN(len(targets))], nil}-// TODO: enable parallelizationfunc (ecb *ecBalancer) balanceEcShardsWithinRacks(collection string) error {// collect vid => []ecNode, since previous steps can change the locationsvidLocations := ecb.collectVolumeIdToEcNodes(collection)racks := ecb.racks()// spread the ec shards evenly+ ecb.wgInit()for vid, locations := range vidLocations {// see the volume's shards are in how many racks, and how many in each rack@@ -811,12 +811,12 @@ func (ecb *ecBalancer) balanceEcShardsWithinRacks(collection string) error {}sourceEcNodes := rackEcNodesWithVid[rackId]averageShardsPerEcNode := ceilDivide(rackToShardCount[rackId], len(possibleDestinationEcNodes))- if err := ecb.doBalanceEcShardsWithinOneRack(averageShardsPerEcNode, collection, vid, sourceEcNodes, possibleDestinationEcNodes); err != nil {- return err- }+ ecb.wgAdd(func() error {+ return ecb.doBalanceEcShardsWithinOneRack(averageShardsPerEcNode, collection, vid, sourceEcNodes, possibleDestinationEcNodes)+ })}}- return nil+ return ecb.wgWait()}func (ecb *ecBalancer) doBalanceEcShardsWithinOneRack(averageShardsPerEcNode int, collection string, vid needle.VolumeId, existingLocations, possibleDestinationEcNodes []*EcNode) error {