From 592f2f23a38a477e234693bccf381bb5d7185a1c Mon Sep 17 00:00:00 2001 From: Krishna Srinivas <634494+krishnasrinivas@users.noreply.github.com> Date: Mon, 26 Oct 2020 18:48:47 -0700 Subject: [PATCH] fix: heal rejects objects with disk re-ordering issue (#10766) --- cmd/erasure-healing.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmd/erasure-healing.go b/cmd/erasure-healing.go index 754aa5e2c..9143b90eb 100644 --- a/cmd/erasure-healing.go +++ b/cmd/erasure-healing.go @@ -221,6 +221,17 @@ func (er erasureObjects) healObject(ctx context.Context, bucket string, object s partsMetadata []FileInfo, errs []error, latestFileInfo FileInfo, dryRun bool, remove bool, scanMode madmin.HealScanMode) (result madmin.HealResultItem, err error) { + for i, metadata := range shufflePartsMetadata(partsMetadata, latestFileInfo.Erasure.Distribution) { + if !metadata.IsValid() { + continue + } + if i != metadata.Erasure.Index-1 { + // FIXME: fix in the next release for objects which erasure.Index does not match + // with expected distribution. + return result, fmt.Errorf("Unable to heal object %s, disk ordering issue detected", pathJoin(bucket, object)) + } + } + dataBlocks := latestFileInfo.Erasure.DataBlocks storageDisks := er.getDisks()