pkg/storage/segments: Clarify logic in Repair method (#2621)
Create a new variable rather than reusing the existing one because the name of the existing one is confusing when reading the logic and it requires more time that the logic doesn't have a bug.
This commit is contained in:
parent
cba008d7df
commit
79e9b62f6d
@ -216,16 +216,17 @@ func (repairer *Repairer) Repair(ctx context.Context, path storj.Path) (err erro
|
||||
mon.FloatVal("healthy_ratio_after_repair").Observe(healthyRatioAfterRepair)
|
||||
|
||||
// if partial repair, include "unhealthy" pieces that are not duplicates
|
||||
revisedPointerPieces := healthyPieces
|
||||
if healthyLength < pointer.Remote.Redundancy.SuccessThreshold {
|
||||
for _, p := range unhealthyPieces {
|
||||
if _, ok := healthyMap[p.GetPieceNum()]; !ok {
|
||||
healthyPieces = append(healthyPieces, p)
|
||||
revisedPointerPieces = append(revisedPointerPieces, p)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update the remote pieces in the pointer
|
||||
pointer.GetRemote().RemotePieces = healthyPieces
|
||||
pointer.GetRemote().RemotePieces = revisedPointerPieces
|
||||
|
||||
// Update the segment pointer in the metainfo
|
||||
return repairer.metainfo.Put(ctx, path, pointer)
|
||||
|
Loading…
Reference in New Issue
Block a user