From 5f7e6d03ffce5ae7da1af7ea5cba344b15ad26d4 Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Wed, 15 Dec 2021 09:18:09 -0800 Subject: [PATCH] copy bucket slice to avoid skipping .minio.sys/buckets (#13912) healing was skipping `.minio.sys/buckets` path so essentially not healing `.usage.json` - fix this by making a copy of `buckets` slice. --- cmd/background-newdisks-heal-ops.go | 16 ++++++++-------- cmd/global-heal.go | 9 ++++++++- cmd/xl-storage.go | 5 ++++- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/cmd/background-newdisks-heal-ops.go b/cmd/background-newdisks-heal-ops.go index 4d128c518..19e7f042f 100644 --- a/cmd/background-newdisks-heal-ops.go +++ b/cmd/background-newdisks-heal-ops.go @@ -375,15 +375,13 @@ func monitorLocalDisksAndHeal(ctx context.Context, z *erasureServerPools, bgSeq buckets, _ := z.ListBuckets(ctx) - buckets = append(buckets, BucketInfo{ - Name: pathJoin(minioMetaBucket, minioConfigPrefix), - }) - // Buckets data are dispersed in multiple zones/sets, make // sure to heal all bucket metadata configuration. - buckets = append(buckets, []BucketInfo{ - {Name: pathJoin(minioMetaBucket, bucketMetaPrefix)}, - }...) + buckets = append(buckets, BucketInfo{ + Name: pathJoin(minioMetaBucket, minioConfigPrefix), + }, BucketInfo{ + Name: pathJoin(minioMetaBucket, bucketMetaPrefix), + }) // Heal latest buckets first. sort.Slice(buckets, func(i, j int) bool { @@ -441,10 +439,12 @@ func monitorLocalDisksAndHeal(ctx context.Context, z *erasureServerPools, bgSeq continue } - logger.Info("Healing disk '%s' on %s pool complete", disk, humanize.Ordinal(i+1)) + logger.Info("Healing disk '%s' on %s pool, %s set complete", disk, + humanize.Ordinal(i+1), humanize.Ordinal(setIndex+1)) logger.Info("Summary:\n") tracker.printTo(os.Stdout) logger.LogIf(ctx, tracker.delete(ctx)) + logger.Info("\n") // Only upon success pop the healed disk. globalBackgroundHealState.popHealLocalDisks(disk.Endpoint()) diff --git a/cmd/global-heal.go b/cmd/global-heal.go index ade64e855..0ee0406df 100644 --- a/cmd/global-heal.go +++ b/cmd/global-heal.go @@ -168,9 +168,14 @@ func (er *erasureObjects) healErasureSet(ctx context.Context, buckets []string, bgSeq := mustGetHealSequence(ctx) scanMode := globalHealConfig.ScanMode() + // Make sure to copy since `buckets slice` + // is modified in place by tracker. + healBuckets := make([]string, len(buckets)) + copy(healBuckets, buckets) + var retErr error // Heal all buckets with all objects - for _, bucket := range buckets { + for _, bucket := range healBuckets { if tracker.isHealed(bucket) { continue } @@ -318,6 +323,8 @@ func (er *erasureObjects) healErasureSet(ctx context.Context, buckets []string, default: tracker.bucketDone(bucket) logger.LogIf(ctx, tracker.update(ctx)) + logger.Info("Healing bucket %s content on %s erasure set complete", + bucket, humanize.Ordinal(tracker.SetIndex+1)) } } tracker.Object = "" diff --git a/cmd/xl-storage.go b/cmd/xl-storage.go index ba761a97f..592f7d58e 100644 --- a/cmd/xl-storage.go +++ b/cmd/xl-storage.go @@ -1962,7 +1962,10 @@ func (s *xlStorage) Delete(ctx context.Context, volume string, path string, recu func (s *xlStorage) RenameData(ctx context.Context, srcVolume, srcPath string, fi FileInfo, dstVolume, dstPath string) (err error) { defer func() { if err != nil { - logger.LogIf(ctx, err) + logger.LogIf(ctx, fmt.Errorf("srcVolume: %s, srcPath: %s, dstVolume: %s:, dstPath: %s - error %v", + srcVolume, srcPath, + dstVolume, dstPath, + err)) } if err == nil { if s.globalSync {