diff options
Diffstat (limited to 'weed/shell/command_ec_balance.go')
| -rw-r--r-- | weed/shell/command_ec_balance.go | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/weed/shell/command_ec_balance.go b/weed/shell/command_ec_balance.go index 424b63d9d..4edf94711 100644 --- a/weed/shell/command_ec_balance.go +++ b/weed/shell/command_ec_balance.go @@ -199,6 +199,7 @@ func doDeduplicateEcShards(ctx context.Context, commandEnv *CommandEnv, collecti if err := sourceServerDeleteEcShards(ctx, commandEnv.option.GrpcDialOption, collection, vid, ecNode.info.Id, duplicatedShardIds); err != nil { return err } + deleteEcVolumeShards(ecNode, vid, duplicatedShardIds) ecNode.freeEcSlot++ } } @@ -273,3 +274,27 @@ func findEcVolumeShards(ecNode *EcNode, vid needle.VolumeId) erasure_coding.Shar return 0 } + +func addEcVolumeShards(ecNode *EcNode, vid needle.VolumeId, shardIds []uint32){ + + for _, shardInfo := range ecNode.info.EcShardInfos { + if needle.VolumeId(shardInfo.Id) == vid { + for _, shardId := range shardIds{ + shardInfo.EcIndexBits = uint32(erasure_coding.ShardBits(shardInfo.EcIndexBits).AddShardId(erasure_coding.ShardId(shardId))) + } + } + } + +} + +func deleteEcVolumeShards(ecNode *EcNode, vid needle.VolumeId, shardIds []uint32){ + + for _, shardInfo := range ecNode.info.EcShardInfos { + if needle.VolumeId(shardInfo.Id) == vid { + for _, shardId := range shardIds{ + shardInfo.EcIndexBits = uint32(erasure_coding.ShardBits(shardInfo.EcIndexBits).RemoveShardId(erasure_coding.ShardId(shardId))) + } + } + } + +} |
