|
|
@ -118,6 +118,7 @@ func initBackgroundHealing(ctx context.Context, objAPI ObjectLayer) { |
|
|
|
// 2. Only the node hosting the disk is responsible to perform the heal
|
|
|
|
// 2. Only the node hosting the disk is responsible to perform the heal
|
|
|
|
func monitorLocalDisksAndHeal(ctx context.Context, z *erasureServerSets, bgSeq *healSequence) { |
|
|
|
func monitorLocalDisksAndHeal(ctx context.Context, z *erasureServerSets, bgSeq *healSequence) { |
|
|
|
// Perform automatic disk healing when a disk is replaced locally.
|
|
|
|
// Perform automatic disk healing when a disk is replaced locally.
|
|
|
|
|
|
|
|
wait: |
|
|
|
for { |
|
|
|
for { |
|
|
|
select { |
|
|
|
select { |
|
|
|
case <-ctx.Done(): |
|
|
|
case <-ctx.Done(): |
|
|
@ -176,6 +177,26 @@ func monitorLocalDisksAndHeal(ctx context.Context, z *erasureServerSets, bgSeq * |
|
|
|
for _, disk := range disks { |
|
|
|
for _, disk := range disks { |
|
|
|
logger.Info("Healing disk '%s' on %s zone", disk, humanize.Ordinal(i+1)) |
|
|
|
logger.Info("Healing disk '%s' on %s zone", disk, humanize.Ordinal(i+1)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// So someone changed the drives underneath, healing tracker missing.
|
|
|
|
|
|
|
|
if !disk.Healing() { |
|
|
|
|
|
|
|
logger.Info("Healing tracker missing on '%s', disk was swapped again on %s zone", disk, humanize.Ordinal(i+1)) |
|
|
|
|
|
|
|
diskID, err := disk.GetDiskID() |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
logger.LogIf(ctx, err) |
|
|
|
|
|
|
|
// reading format.json failed or not found, proceed to look
|
|
|
|
|
|
|
|
// for new disks to be healed again, we cannot proceed further.
|
|
|
|
|
|
|
|
goto wait |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if err := saveHealingTracker(disk, diskID); err != nil { |
|
|
|
|
|
|
|
logger.LogIf(ctx, err) |
|
|
|
|
|
|
|
// Unable to write healing tracker, permission denied or some
|
|
|
|
|
|
|
|
// other unexpected error occurred. Proceed to look for new
|
|
|
|
|
|
|
|
// disks to be healed again, we cannot proceed further.
|
|
|
|
|
|
|
|
goto wait |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
lbDisks := z.serverSets[i].sets[setIndex].getOnlineDisks() |
|
|
|
lbDisks := z.serverSets[i].sets[setIndex].getOnlineDisks() |
|
|
|
if err := healErasureSet(ctx, setIndex, buckets, lbDisks); err != nil { |
|
|
|
if err := healErasureSet(ctx, setIndex, buckets, lbDisks); err != nil { |
|
|
|
logger.LogIf(ctx, err) |
|
|
|
logger.LogIf(ctx, err) |
|
|
|