aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_ec_common.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2019-11-12 09:33:51 -0800
committerChris Lu <chris.lu@gmail.com>2019-11-12 09:33:51 -0800
commit717ec47fa2bac87d5dfd5137531f60bdf57b7007 (patch)
tree9f361951cd03254fd7de0cf324ebfcb9ce6faa5c /weed/shell/command_ec_common.go
parent5d61b67e62deabd538b8e6e5374aa5883db02fe2 (diff)
downloadseaweedfs-717ec47fa2bac87d5dfd5137531f60bdf57b7007.tar.xz
seaweedfs-717ec47fa2bac87d5dfd5137531f60bdf57b7007.zip
avoid double counting ec slot
addressing issue found in https://github.com/chrislusf/seaweedfs/issues/1111 The ec slots are already counted on the server side.
Diffstat (limited to 'weed/shell/command_ec_common.go')
-rw-r--r--weed/shell/command_ec_common.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/weed/shell/command_ec_common.go b/weed/shell/command_ec_common.go
index 1e9d96212..cdd687d13 100644
--- a/weed/shell/command_ec_common.go
+++ b/weed/shell/command_ec_common.go
@@ -156,7 +156,7 @@ func countShards(ecShardInfos []*master_pb.VolumeEcShardInformationMessage) (cou
}
func countFreeShardSlots(dn *master_pb.DataNodeInfo) (count int) {
- return int(dn.FreeVolumeCount)*erasure_coding.DataShardsCount - countShards(dn.EcShardInfos)
+ return int(dn.MaxVolumeCount-dn.ActiveVolumeCount)*erasure_coding.DataShardsCount - countShards(dn.EcShardInfos)
}
type RackId string
@@ -191,15 +191,15 @@ func collectEcNodes(ctx context.Context, commandEnv *CommandEnv, selectedDataCen
if selectedDataCenter != "" && selectedDataCenter != dc {
return
}
- if freeEcSlots := countFreeShardSlots(dn); freeEcSlots > 0 {
- ecNodes = append(ecNodes, &EcNode{
- info: dn,
- dc: dc,
- rack: rack,
- freeEcSlot: int(freeEcSlots),
- })
- totalFreeEcSlots += freeEcSlots
- }
+
+ freeEcSlots := countFreeShardSlots(dn)
+ ecNodes = append(ecNodes, &EcNode{
+ info: dn,
+ dc: dc,
+ rack: rack,
+ freeEcSlot: int(freeEcSlots),
+ })
+ totalFreeEcSlots += freeEcSlots
})
sortEcNodes(ecNodes)