mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
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.
This commit is contained in:
parent
5d61b67e62
commit
717ec47fa2
|
@ -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,7 +191,8 @@ func collectEcNodes(ctx context.Context, commandEnv *CommandEnv, selectedDataCen
|
|||
if selectedDataCenter != "" && selectedDataCenter != dc {
|
||||
return
|
||||
}
|
||||
if freeEcSlots := countFreeShardSlots(dn); freeEcSlots > 0 {
|
||||
|
||||
freeEcSlots := countFreeShardSlots(dn)
|
||||
ecNodes = append(ecNodes, &EcNode{
|
||||
info: dn,
|
||||
dc: dc,
|
||||
|
@ -199,7 +200,6 @@ func collectEcNodes(ctx context.Context, commandEnv *CommandEnv, selectedDataCen
|
|||
freeEcSlot: int(freeEcSlots),
|
||||
})
|
||||
totalFreeEcSlots += freeEcSlots
|
||||
}
|
||||
})
|
||||
|
||||
sortEcNodes(ecNodes)
|
||||
|
|
Loading…
Reference in a new issue