mirror of
https://github.com/minio/minio.git
synced 2025-11-09 13:39:46 -05:00
xl: Add stat calls to keep track of ignored errors. (#4117)
Such that in a situation where all errors were ignored we need to reduce the errors using readQuorum to get a consistent error value. Without this change errors generated will never be consistent with for an expected scenario. For example in a 6 disk setup 1 disk is missing and 5 do not have the volume (testbucket) Without this change Stat() would result in different errors depending on which disk died. Can cause confusion to S3 client application. This change addresses need to track type of errors we ignored and bring readQuorum to choose the maximally occuring as the value of truth.
This commit is contained in:
@@ -208,25 +208,28 @@ func (xl xlObjects) removeObjectPart(bucket, object, uploadID, partName string)
|
||||
|
||||
// statPart - returns fileInfo structure for a successful stat on part file.
|
||||
func (xl xlObjects) statPart(bucket, object, uploadID, partName string) (fileInfo FileInfo, err error) {
|
||||
var ignoredErrs []error
|
||||
partNamePath := path.Join(bucket, object, uploadID, partName)
|
||||
for _, disk := range xl.getLoadBalancedDisks() {
|
||||
if disk == nil {
|
||||
ignoredErrs = append(ignoredErrs, errDiskNotFound)
|
||||
continue
|
||||
}
|
||||
fileInfo, err = disk.StatFile(minioMetaMultipartBucket, partNamePath)
|
||||
if err == nil {
|
||||
return fileInfo, nil
|
||||
}
|
||||
err = traceError(err)
|
||||
// For any reason disk was deleted or goes offline we continue to next disk.
|
||||
if isErrIgnored(err, objMetadataOpIgnoredErrs...) {
|
||||
ignoredErrs = append(ignoredErrs, err)
|
||||
continue
|
||||
}
|
||||
|
||||
// Catastrophic error, we return.
|
||||
break
|
||||
// Error is not ignored, return right here.
|
||||
return FileInfo{}, traceError(err)
|
||||
}
|
||||
return FileInfo{}, err
|
||||
// If all errors were ignored, reduce to maximal occurrence
|
||||
// based on the read quorum.
|
||||
return FileInfo{}, reduceReadQuorumErrs(ignoredErrs, nil, xl.readQuorum)
|
||||
}
|
||||
|
||||
// commitXLMetadata - commit `xl.json` from source prefix to destination prefix in the given slice of disks.
|
||||
|
||||
Reference in New Issue
Block a user