satellite/repair: remove healthy from irreparabledb

Change-Id: Ia9d300d0359883f03734d0bdf204d56d6642ce34
This commit is contained in:
paul cannon 2020-06-24 13:56:15 -05:00 committed by Yingrong Zhao
parent bdaabd611d
commit 4997fd55d0

View File

@ -191,6 +191,9 @@ func (checker *Checker) updateIrreparableSegmentStatus(ctx context.Context, poin
// we repair when the number of healthy pieces is less than or equal to the repair threshold and is greater or equal to
// minimum required pieces in redundancy
// except for the case when the repair and success thresholds are the same (a case usually seen during testing)
//
// If the segment is suddenly entirely healthy again, we don't need to repair and we don't need to
// keep it in the irreparabledb queue either.
if numHealthy >= redundancy.MinReq && numHealthy <= repairThreshold && numHealthy < redundancy.SuccessThreshold {
_, err = checker.repairQueue.Insert(ctx, &pb.InjuredSegment{
Path: []byte(path),
@ -222,6 +225,11 @@ func (checker *Checker) updateIrreparableSegmentStatus(ctx context.Context, poin
if err != nil {
return errs.Combine(Error.New("error handling irreparable segment to queue"), err)
}
} else if numHealthy > repairThreshold || numHealthy >= redundancy.SuccessThreshold {
err = checker.irrdb.Delete(ctx, []byte(path))
if err != nil {
return Error.New("error removing segment from irreparable queue: %v", err)
}
}
return nil
}