mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
refactor(command_ec_decode): exisitngEcIndexBits
-> `existingEcInde… (#3674)
refactor(command_ec_decode): `exisitngEcIndexBits` -> `existingEcIndexBits` Signed-off-by: Ryan Russell <git@ryanrussell.org> Signed-off-by: Ryan Russell <git@ryanrussell.org>
This commit is contained in:
parent
f2dde2b1da
commit
dfbd8efd26
|
@ -171,13 +171,13 @@ func generateNormalVolume(grpcDialOption grpc.DialOption, vid needle.VolumeId, c
|
||||||
func collectEcShards(commandEnv *CommandEnv, nodeToEcIndexBits map[pb.ServerAddress]erasure_coding.ShardBits, collection string, vid needle.VolumeId) (targetNodeLocation pb.ServerAddress, err error) {
|
func collectEcShards(commandEnv *CommandEnv, nodeToEcIndexBits map[pb.ServerAddress]erasure_coding.ShardBits, collection string, vid needle.VolumeId) (targetNodeLocation pb.ServerAddress, err error) {
|
||||||
|
|
||||||
maxShardCount := 0
|
maxShardCount := 0
|
||||||
var exisitngEcIndexBits erasure_coding.ShardBits
|
var existingEcIndexBits erasure_coding.ShardBits
|
||||||
for loc, ecIndexBits := range nodeToEcIndexBits {
|
for loc, ecIndexBits := range nodeToEcIndexBits {
|
||||||
toBeCopiedShardCount := ecIndexBits.MinusParityShards().ShardIdCount()
|
toBeCopiedShardCount := ecIndexBits.MinusParityShards().ShardIdCount()
|
||||||
if toBeCopiedShardCount > maxShardCount {
|
if toBeCopiedShardCount > maxShardCount {
|
||||||
maxShardCount = toBeCopiedShardCount
|
maxShardCount = toBeCopiedShardCount
|
||||||
targetNodeLocation = loc
|
targetNodeLocation = loc
|
||||||
exisitngEcIndexBits = ecIndexBits
|
existingEcIndexBits = ecIndexBits
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ func collectEcShards(commandEnv *CommandEnv, nodeToEcIndexBits map[pb.ServerAddr
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
needToCopyEcIndexBits := ecIndexBits.Minus(exisitngEcIndexBits).MinusParityShards()
|
needToCopyEcIndexBits := ecIndexBits.Minus(existingEcIndexBits).MinusParityShards()
|
||||||
if needToCopyEcIndexBits.ShardIdCount() == 0 {
|
if needToCopyEcIndexBits.ShardIdCount() == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -222,7 +222,7 @@ func collectEcShards(commandEnv *CommandEnv, nodeToEcIndexBits map[pb.ServerAddr
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nodeToEcIndexBits[targetNodeLocation] = exisitngEcIndexBits.Plus(copiedEcIndexBits)
|
nodeToEcIndexBits[targetNodeLocation] = existingEcIndexBits.Plus(copiedEcIndexBits)
|
||||||
|
|
||||||
return targetNodeLocation, err
|
return targetNodeLocation, err
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue