diff options
| author | bingoohuang <bingoo.huang@gmail.com> | 2021-04-26 17:15:17 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-26 17:15:17 +0800 |
| commit | 4ee58922eff61a5a4ca29c0b4829b097a498549e (patch) | |
| tree | 301805fef4aa5d0096bfb1510536f7a009b661e7 /weed/topology | |
| parent | 5cdff56731d6be220d4d6e8624b859520dfeb021 (diff) | |
| parent | 86185262bb86e31f9a2f71e85d02df2502c7ad40 (diff) | |
| download | seaweedfs-4ee58922eff61a5a4ca29c0b4829b097a498549e.tar.xz seaweedfs-4ee58922eff61a5a4ca29c0b4829b097a498549e.zip | |
Merge pull request #6 from chrislusf/master
Diffstat (limited to 'weed/topology')
| -rw-r--r-- | weed/topology/data_node_ec.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/weed/topology/data_node_ec.go b/weed/topology/data_node_ec.go index df1b6d658..330b16b24 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 deletedShards var newShardCount, deletedShardCount int for _, 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 { |
