diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-06-05 23:20:26 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-06-05 23:20:26 -0700 |
| commit | d344e0a035985ce7a28a6f7a4499199ef27aeda3 (patch) | |
| tree | 77f094232aab9c2e767adb05f81c4e7a9453c2e2 /weed/shell/command_ec_balance.go | |
| parent | 450f4733cec38ec31c66b296749e2d0b14e91218 (diff) | |
| download | seaweedfs-d344e0a035985ce7a28a6f7a4499199ef27aeda3.tar.xz seaweedfs-d344e0a035985ce7a28a6f7a4499199ef27aeda3.zip | |
fix ec related bugs
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))) + } + } + } + +} |
