mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
List only objects that need healing (#2546)
This commit is contained in:
parent
e1b0985b5b
commit
200d327737
@ -134,7 +134,7 @@ func xlLatestMetadata(partsMetadata []xlMetaV1, errs []error) (latestMeta xlMeta
|
|||||||
func xlShouldHeal(partsMetadata []xlMetaV1, errs []error) bool {
|
func xlShouldHeal(partsMetadata []xlMetaV1, errs []error) bool {
|
||||||
modTime := commonTime(listObjectModtimes(partsMetadata, errs))
|
modTime := commonTime(listObjectModtimes(partsMetadata, errs))
|
||||||
for index := range partsMetadata {
|
for index := range partsMetadata {
|
||||||
if errs[index] == errFileNotFound {
|
if errs[index] == errDiskNotFound {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if errs[index] != nil {
|
if errs[index] != nil {
|
||||||
|
@ -137,6 +137,10 @@ func (xl xlObjects) listObjectsHeal(bucket, prefix, marker, delimiter string, ma
|
|||||||
result.Prefixes = append(result.Prefixes, objInfo.Name)
|
result.Prefixes = append(result.Prefixes, objInfo.Name)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// Check if the current object needs healing
|
||||||
|
nsMutex.RLock(bucket, objInfo.Name)
|
||||||
|
partsMetadata, errs := readAllXLMetadata(xl.storageDisks, bucket, objInfo.Name)
|
||||||
|
if xlShouldHeal(partsMetadata, errs) {
|
||||||
result.Objects = append(result.Objects, ObjectInfo{
|
result.Objects = append(result.Objects, ObjectInfo{
|
||||||
Name: objInfo.Name,
|
Name: objInfo.Name,
|
||||||
ModTime: objInfo.ModTime,
|
ModTime: objInfo.ModTime,
|
||||||
@ -144,6 +148,8 @@ func (xl xlObjects) listObjectsHeal(bucket, prefix, marker, delimiter string, ma
|
|||||||
IsDir: false,
|
IsDir: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
nsMutex.RUnlock(bucket, objInfo.Name)
|
||||||
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user