mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
purge duplicated ec shards
This commit is contained in:
parent
b05456fe07
commit
6cea23d091
|
@ -186,18 +186,20 @@ func doDeduplicateEcShards(ctx context.Context, commandEnv *commandEnv, collecti
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
sortEcNodes(ecNodes)
|
sortEcNodes(ecNodes)
|
||||||
fmt.Printf("ec shard %d.%d has %d copies, removing from %+v\n", vid, shardId, len(ecNodes), ecNodes[1:])
|
fmt.Printf("ec shard %d.%d has %d copies, keeping %v\n", vid, shardId, len(ecNodes), ecNodes[0].info.Id)
|
||||||
if !applyBalancing {
|
if !applyBalancing {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
for _, ecNode := range ecNodes[1:] {
|
|
||||||
duplicatedShardIds := []uint32{uint32(shardId)}
|
duplicatedShardIds := []uint32{uint32(shardId)}
|
||||||
|
for _, ecNode := range ecNodes[1:] {
|
||||||
if err := unmountEcShards(ctx, commandEnv.option.GrpcDialOption, vid, ecNode.info.Id, duplicatedShardIds); err != nil {
|
if err := unmountEcShards(ctx, commandEnv.option.GrpcDialOption, vid, ecNode.info.Id, duplicatedShardIds); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if err := sourceServerDeleteEcShards(ctx, commandEnv.option.GrpcDialOption, collection, vid, ecNode.info.Id, duplicatedShardIds); err != nil {
|
if err := sourceServerDeleteEcShards(ctx, commandEnv.option.GrpcDialOption, collection, vid, ecNode.info.Id, duplicatedShardIds); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
ecNode.freeEcSlot++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue