Heal restored object contents on disk (#12238)

This commit is contained in:
Krishnan Parthasarathi 2021-05-06 16:06:57 -07:00 committed by GitHub
parent d495cb68d3
commit 0bab1c1895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 7 deletions

View File

@ -23,7 +23,6 @@ import (
"time" "time"
"github.com/minio/madmin-go" "github.com/minio/madmin-go"
"github.com/minio/minio/pkg/bucket/lifecycle"
) )
// commonTime returns a maximally occurring time from a list of time. // commonTime returns a maximally occurring time from a list of time.
@ -280,11 +279,11 @@ func disksWithAllParts(ctx context.Context, onlineDisks []StorageAPI, partsMetad
// disk has a valid xl.meta but may not have all the // disk has a valid xl.meta but may not have all the
// parts. This is considered an outdated disk, since // parts. This is considered an outdated disk, since
// it needs healing too. // it needs healing too.
if partsMetadata[i].TransitionStatus != lifecycle.TransitionComplete { if !partsMetadata[i].IsRemote() {
dataErrs[i] = onlineDisk.VerifyFile(ctx, bucket, object, partsMetadata[i]) dataErrs[i] = onlineDisk.VerifyFile(ctx, bucket, object, partsMetadata[i])
} }
case madmin.HealNormalScan: case madmin.HealNormalScan:
if partsMetadata[i].TransitionStatus != lifecycle.TransitionComplete { if !partsMetadata[i].IsRemote() {
dataErrs[i] = onlineDisk.CheckParts(ctx, bucket, object, partsMetadata[i]) dataErrs[i] = onlineDisk.CheckParts(ctx, bucket, object, partsMetadata[i])
} }
} }

View File

@ -213,7 +213,7 @@ func shouldHealObjectOnDisk(erErr, dataErr error, meta FileInfo, quorumModTime t
return true return true
} }
if erErr == nil { if erErr == nil {
if meta.TransitionStatus != lifecycle.TransitionComplete { if !meta.IsRemote() {
// If xl.meta was read fine but there may be problem with the part.N files. // If xl.meta was read fine but there may be problem with the part.N files.
if IsErr(dataErr, []error{ if IsErr(dataErr, []error{
errFileNotFound, errFileNotFound,
@ -271,7 +271,6 @@ func (er erasureObjects) healObject(ctx context.Context, bucket string, object s
// List of disks having all parts as per latest er.meta. // List of disks having all parts as per latest er.meta.
availableDisks, dataErrs := disksWithAllParts(ctx, latestDisks, partsMetadata, errs, bucket, object, scanMode) availableDisks, dataErrs := disksWithAllParts(ctx, latestDisks, partsMetadata, errs, bucket, object, scanMode)
// Loop to find number of disks with valid data, per-drive // Loop to find number of disks with valid data, per-drive
// data state and a list of outdated disks on which data needs // data state and a list of outdated disks on which data needs
// to be healed. // to be healed.
@ -367,7 +366,7 @@ func (er erasureObjects) healObject(ctx context.Context, bucket string, object s
nfi := fi nfi := fi
nfi.Erasure.Index = 0 nfi.Erasure.Index = 0
nfi.Erasure.Checksums = nil nfi.Erasure.Checksums = nil
if fi.TransitionStatus != lifecycle.TransitionComplete { if fi.IsRemote() {
nfi.Parts = nil nfi.Parts = nil
} }
return nfi return nfi
@ -401,7 +400,7 @@ func (er erasureObjects) healObject(ctx context.Context, bucket string, object s
inlineBuffers = make([]*bytes.Buffer, len(outDatedDisks)) inlineBuffers = make([]*bytes.Buffer, len(outDatedDisks))
} }
if !latestMeta.Deleted && latestMeta.TransitionStatus != lifecycle.TransitionComplete { if !latestMeta.Deleted && !latestMeta.IsRemote() {
result.DataBlocks = latestMeta.Erasure.DataBlocks result.DataBlocks = latestMeta.Erasure.DataBlocks
result.ParityBlocks = latestMeta.Erasure.ParityBlocks result.ParityBlocks = latestMeta.Erasure.ParityBlocks