XL/multipart: statPart should ignore errDiskNotFound. (#1862)

startPart should also take uploadId and partName as arguments.
This commit is contained in:
Harshavardhana
2016-06-07 18:15:04 -07:00
parent d13e6e7156
commit 51f3d4e0ca
7 changed files with 372 additions and 72 deletions

View File

@@ -56,37 +56,21 @@ func (xl xlObjects) parentDirIsObject(bucket, parent string) bool {
// isObject - returns `true` if the prefix is an object i.e if
// `xl.json` exists at the leaf, false otherwise.
func (xl xlObjects) isObject(bucket, prefix string) bool {
func (xl xlObjects) isObject(bucket, prefix string) (ok bool) {
for _, disk := range xl.getLoadBalancedQuorumDisks() {
if disk == nil {
continue
}
// Check if 'prefix' is an object in this 'disk', else continue the check with next disk
// Check if 'prefix' is an object on this 'disk', else continue the check the next disk
_, err := disk.StatFile(bucket, path.Join(prefix, xlMetaJSONFile))
if err != nil {
if err == errFileNotFound || err == errDiskNotFound {
continue
}
// TODO: log the error
} else {
if err == nil {
return true
}
}
return false
}
// statPart - returns fileInfo structure for a successful stat on part file.
func (xl xlObjects) statPart(bucket, objectPart string) (fileInfo FileInfo, err error) {
for _, disk := range xl.getLoadBalancedQuorumDisks() {
if disk == nil {
// Ignore for file not found and disk not found.
if err == errFileNotFound || err == errDiskNotFound {
continue
}
fileInfo, err = disk.StatFile(bucket, objectPart)
if err != nil {
return FileInfo{}, err
}
break
}
return fileInfo, nil
errorIf(err, "Unable to stat a file %s/%s/%s", bucket, prefix, xlMetaJSONFile)
} // Exhausted all disks - return false.
return false
}