mirror of
https://github.com/minio/minio.git
synced 2025-04-13 07:50:15 -04:00
heal: Should delete stale object parts before healing (#3649)
This commit is contained in:
parent
cc1575f944
commit
864b8795aa
@ -344,22 +344,34 @@ func healObject(storageDisks []StorageAPI, bucket string, object string, quorum
|
|||||||
// Not an outdated disk.
|
// Not an outdated disk.
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if errs[index] != nil {
|
|
||||||
// If there was an error (most likely errFileNotFound)
|
// errFileNotFound implies that xl.json is missing. We
|
||||||
|
// may have object parts still present in the object
|
||||||
|
// directory. This needs to be deleted for object to
|
||||||
|
// healed successfully.
|
||||||
|
if errs[index] != nil && !isErr(errs[index], errFileNotFound) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Outdated object with the same name exists that needs to be deleted.
|
// Outdated object with the same name exists that needs to be deleted.
|
||||||
outDatedMeta := partsMetadata[index]
|
outDatedMeta := partsMetadata[index]
|
||||||
// Delete all the parts.
|
// Consult valid metadata picked when there is no
|
||||||
for partIndex := 0; partIndex < len(outDatedMeta.Parts); partIndex++ {
|
// metadata available on this disk.
|
||||||
err := disk.DeleteFile(bucket, pathJoin(object, outDatedMeta.Parts[partIndex].Name))
|
if isErr(errs[index], errFileNotFound) {
|
||||||
if err != nil {
|
outDatedMeta = latestMeta
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete all the parts. Ignore if parts are not found.
|
||||||
|
for _, part := range outDatedMeta.Parts {
|
||||||
|
err := disk.DeleteFile(bucket, pathJoin(object, part.Name))
|
||||||
|
if err != nil && !isErr(err, errFileNotFound) {
|
||||||
return traceError(err)
|
return traceError(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Delete xl.json file.
|
|
||||||
|
// Delete xl.json file. Ignore if xl.json not found.
|
||||||
err := disk.DeleteFile(bucket, pathJoin(object, xlMetaJSONFile))
|
err := disk.DeleteFile(bucket, pathJoin(object, xlMetaJSONFile))
|
||||||
if err != nil {
|
if err != nil && !isErr(err, errFileNotFound) {
|
||||||
return traceError(err)
|
return traceError(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user