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 EC shard count logic
Patrick Schmidt7413d5975068
diff --git a/weed/topology/data_node_ec.go b/weed/topology/data_node_ec.goindex df1b6d658c..330b16b24f 100644--- a/weed/topology/data_node_ec.go+++ b/weed/topology/data_node_ec.go@@ -25,7 +25,7 @@ func (dn *DataNode) UpdateEcShards(actualShards []*erasure_coding.EcVolumeInfo)existingEcShards := dn.GetEcShards()- // found out the newShards and deletedShards+ // find out the newShards and deletedShardsvar newShardCount, deletedShardCount intfor _, ecShards := range existingEcShards {@@ -56,20 +56,19 @@ func (dn *DataNode) UpdateEcShards(actualShards []*erasure_coding.EcVolumeInfo)disk.UpAdjustDiskUsageDelta(deltaDiskUsages)}+for _, ecShards := range actualShards {+ if dn.hasEcShards(ecShards.VolumeId) {+ continue+ }++ newShards = append(newShards, ecShards)disk := dn.getOrCreateDisk(ecShards.DiskType)deltaDiskUsages := newDiskUsages()deltaDiskUsage := deltaDiskUsages.getOrCreateDisk(types.ToDiskType(ecShards.DiskType))-- if !dn.hasEcShards(ecShards.VolumeId) {- newShards = append(newShards, ecShards)- newShardCount += ecShards.ShardIdCount()- }-- deltaDiskUsage.ecShardCount = int64(newShardCount)+ deltaDiskUsage.ecShardCount = int64(ecShards.ShardIdCount())disk.UpAdjustDiskUsageDelta(deltaDiskUsages)-}if len(newShards) > 0 || len(deletedShards) > 0 {