|
|
@ -608,16 +608,28 @@ func (xl xlObjects) healObjectDir(ctx context.Context, bucket, object string, dr |
|
|
|
// and later the disk comes back up again, heal on the object
|
|
|
|
// and later the disk comes back up again, heal on the object
|
|
|
|
// should delete it.
|
|
|
|
// should delete it.
|
|
|
|
func (xl xlObjects) HealObject(ctx context.Context, bucket, object string, dryRun bool) (hr madmin.HealResultItem, err error) { |
|
|
|
func (xl xlObjects) HealObject(ctx context.Context, bucket, object string, dryRun bool) (hr madmin.HealResultItem, err error) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create context that also contains information about the object and bucket.
|
|
|
|
|
|
|
|
// The top level handler might not have this information.
|
|
|
|
|
|
|
|
reqInfo := logger.GetReqInfo(ctx) |
|
|
|
|
|
|
|
var newReqInfo *logger.ReqInfo |
|
|
|
|
|
|
|
if reqInfo != nil { |
|
|
|
|
|
|
|
newReqInfo = logger.NewReqInfo(reqInfo.RemoteHost, reqInfo.UserAgent, reqInfo.RequestID, reqInfo.API, bucket, object) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
newReqInfo = logger.NewReqInfo("", "", "", "Heal", bucket, object) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
healCtx := logger.SetReqInfo(context.Background(), newReqInfo) |
|
|
|
|
|
|
|
|
|
|
|
// Healing directories handle it separately.
|
|
|
|
// Healing directories handle it separately.
|
|
|
|
if hasSuffix(object, slashSeparator) { |
|
|
|
if hasSuffix(object, slashSeparator) { |
|
|
|
return xl.healObjectDir(ctx, bucket, object, dryRun) |
|
|
|
return xl.healObjectDir(healCtx, bucket, object, dryRun) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// FIXME: Metadata is read again in the healObject() call below.
|
|
|
|
// FIXME: Metadata is read again in the healObject() call below.
|
|
|
|
// Read metadata files from all the disks
|
|
|
|
// Read metadata files from all the disks
|
|
|
|
partsMetadata, errs := readAllXLMetadata(ctx, xl.getDisks(), bucket, object) |
|
|
|
partsMetadata, errs := readAllXLMetadata(healCtx, xl.getDisks(), bucket, object) |
|
|
|
|
|
|
|
|
|
|
|
latestXLMeta, err := getLatestXLMeta(ctx, partsMetadata, errs) |
|
|
|
latestXLMeta, err := getLatestXLMeta(healCtx, partsMetadata, errs) |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return hr, toObjectErr(err, bucket, object) |
|
|
|
return hr, toObjectErr(err, bucket, object) |
|
|
|
} |
|
|
|
} |
|
|
@ -630,5 +642,5 @@ func (xl xlObjects) HealObject(ctx context.Context, bucket, object string, dryRu |
|
|
|
defer objectLock.RUnlock() |
|
|
|
defer objectLock.RUnlock() |
|
|
|
|
|
|
|
|
|
|
|
// Heal the object.
|
|
|
|
// Heal the object.
|
|
|
|
return healObject(ctx, xl.getDisks(), bucket, object, latestXLMeta.Erasure.DataBlocks, dryRun) |
|
|
|
return healObject(healCtx, xl.getDisks(), bucket, object, latestXLMeta.Erasure.DataBlocks, dryRun) |
|
|
|
} |
|
|
|
} |
|
|
|