diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-05-23 23:34:29 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-05-23 23:34:29 -0700 |
| commit | 8838176d822927a2bd17c5d51fab9ff6ff1fcb58 (patch) | |
| tree | 1fb67fba2c93943a31cb83ef0b9acaa45c72124c /weed/topology/data_node_ec.go | |
| parent | 8a96445f402a240956adf081de3a675e2e41c767 (diff) | |
| download | seaweedfs-8838176d822927a2bd17c5d51fab9ff6ff1fcb58.tar.xz seaweedfs-8838176d822927a2bd17c5d51fab9ff6ff1fcb58.zip | |
register ec shards to topology
Diffstat (limited to 'weed/topology/data_node_ec.go')
| -rw-r--r-- | weed/topology/data_node_ec.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/weed/topology/data_node_ec.go b/weed/topology/data_node_ec.go index ef395dbdb..e8ead5511 100644 --- a/weed/topology/data_node_ec.go +++ b/weed/topology/data_node_ec.go @@ -18,23 +18,23 @@ func (dn *DataNode) UpdateEcShards(actualShards []*erasure_coding.EcVolumeInfo) // prepare the new ec shard map actualEcShardMap := make(map[needle.VolumeId]*erasure_coding.EcVolumeInfo) for _, ecShards := range actualShards { - actualEcShardMap[ecShards.VolumeId]= ecShards + actualEcShardMap[ecShards.VolumeId] = ecShards } // found out the newShards and deletedShards dn.ecShardsLock.RLock() - for vid, ecShards := range dn.ecShards{ + for vid, ecShards := range dn.ecShards { if actualEcShards, ok := actualEcShardMap[vid]; !ok { // dn registered ec shards not found in the new set of ec shards deletedShards = append(deletedShards, ecShards) } else { // found, but maybe the actual shard could be missing a := actualEcShards.Minus(ecShards) - if len(a.ShardIds())>0 { + if len(a.ShardIds()) > 0 { newShards = append(newShards, a) } d := ecShards.Minus(actualEcShards) - if len(d.ShardIds())>0 { + if len(d.ShardIds()) > 0 { deletedShards = append(deletedShards, d) } } @@ -46,7 +46,7 @@ func (dn *DataNode) UpdateEcShards(actualShards []*erasure_coding.EcVolumeInfo) } dn.ecShardsLock.RUnlock() - if len(newShards)>0 || len(deletedShards)>0{ + if len(newShards) > 0 || len(deletedShards) > 0 { // if changed, set to the new ec shard map dn.ecShardsLock.Lock() dn.ecShards = actualEcShardMap |
