mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-22 00:47:24 +08:00
fix ec related bugs
This commit is contained in:
@@ -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)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -35,7 +35,14 @@ func moveMountedShardToEcNode(ctx context.Context, commandEnv *CommandEnv, exist
|
||||
}
|
||||
|
||||
// ask source node to delete the shard, and maybe the ecx file
|
||||
return sourceServerDeleteEcShards(ctx, commandEnv.option.GrpcDialOption, collection, vid, existingLocation.info.Id, copiedShardIds)
|
||||
err = sourceServerDeleteEcShards(ctx, commandEnv.option.GrpcDialOption, collection, vid, existingLocation.info.Id, copiedShardIds)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
deleteEcVolumeShards(existingLocation, vid, copiedShardIds)
|
||||
|
||||
return nil
|
||||
|
||||
}
|
||||
|
||||
|
@@ -163,6 +163,8 @@ func rebuildOneEcVolume(ctx context.Context, commandEnv *CommandEnv, rebuilder *
|
||||
return err
|
||||
}
|
||||
|
||||
addEcVolumeShards(rebuilder, volumeId, generatedShardIds)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user