@ -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 exisi tngEcIndexBits erasure_coding . ShardBits
var existi ngEcIndexBits 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
exisi tngEcIndexBits = ecIndexBits
existi ngEcIndexBits = ecIndexBits
}
}
}
}
@ -189,7 +189,7 @@ func collectEcShards(commandEnv *CommandEnv, nodeToEcIndexBits map[pb.ServerAddr
continue
continue
}
}
needToCopyEcIndexBits := ecIndexBits . Minus ( exisi tngEcIndexBits ) . MinusParityShards ( )
needToCopyEcIndexBits := ecIndexBits . Minus ( existi ngEcIndexBits ) . 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 ] = exisi tngEcIndexBits . Plus ( copiedEcIndexBits )
nodeToEcIndexBits [ targetNodeLocation ] = existi ngEcIndexBits . Plus ( copiedEcIndexBits )
return targetNodeLocation , err
return targetNodeLocation , err