List only objects that need healing (#2546)

This commit is contained in:
Anis Elleuch
2016-08-24 18:13:01 +01:00
committed by Harshavardhana
parent e1b0985b5b
commit 200d327737
2 changed files with 13 additions and 7 deletions

View File

@@ -137,12 +137,18 @@ func (xl xlObjects) listObjectsHeal(bucket, prefix, marker, delimiter string, ma
result.Prefixes = append(result.Prefixes, objInfo.Name)
continue
}
result.Objects = append(result.Objects, ObjectInfo{
Name: objInfo.Name,
ModTime: objInfo.ModTime,
Size: objInfo.Size,
IsDir: false,
})
// 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{
Name: objInfo.Name,
ModTime: objInfo.ModTime,
Size: objInfo.Size,
IsDir: false,
})
}
nsMutex.RUnlock(bucket, objInfo.Name)
}
return result, nil
}