mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
XL: Don't return ignored errors in listDirFactory (#3935)
Previously, erasure backend's `listDirFactory` may return errors which were explicitly ignored. With this change, it returns nil. Superfluous checks at higher-layers for ignored errors are removed as well.
This commit is contained in:
parent
1396e91dd1
commit
eb02261642
@ -348,10 +348,12 @@ func TestListDir(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
// None of the disks are available, should get errDiskNotFound.
|
// None of the disks are available, should get
|
||||||
|
// errDiskNotFound. Since errDiskNotFound is an ignored error,
|
||||||
|
// we should get nil.
|
||||||
_, _, err = listDir(volume, "", "")
|
_, _, err = listDir(volume, "", "")
|
||||||
if errorCause(err) != errDiskNotFound {
|
if err != nil {
|
||||||
t.Error("expected errDiskNotFound error.")
|
t.Errorf("expected nil error but found %v.", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,10 +107,6 @@ func (xl xlObjects) listObjectsHeal(bucket, prefix, marker, delimiter string, ma
|
|||||||
}
|
}
|
||||||
// For any walk error return right away.
|
// For any walk error return right away.
|
||||||
if walkResult.err != nil {
|
if walkResult.err != nil {
|
||||||
// File not found is a valid case.
|
|
||||||
if walkResult.err == errFileNotFound {
|
|
||||||
return ListObjectsInfo{}, nil
|
|
||||||
}
|
|
||||||
return ListObjectsInfo{}, toObjectErr(walkResult.err, bucket, prefix)
|
return ListObjectsInfo{}, toObjectErr(walkResult.err, bucket, prefix)
|
||||||
}
|
}
|
||||||
entry := walkResult.entry
|
entry := walkResult.entry
|
||||||
@ -325,12 +321,6 @@ func (xl xlObjects) listMultipartUploadsHeal(bucket, prefix, keyMarker,
|
|||||||
}
|
}
|
||||||
// Collect uploads until maxUploads limit is reached.
|
// Collect uploads until maxUploads limit is reached.
|
||||||
for walkResult := range walkerCh {
|
for walkResult := range walkerCh {
|
||||||
// Ignore errors like errDiskNotFound
|
|
||||||
// and errFileNotFound.
|
|
||||||
if isErrIgnored(walkResult.err,
|
|
||||||
xlTreeWalkIgnoredErrs...) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// For any error during tree walk we should
|
// For any error during tree walk we should
|
||||||
// return right away.
|
// return right away.
|
||||||
if walkResult.err != nil {
|
if walkResult.err != nil {
|
||||||
|
@ -27,19 +27,20 @@ func listDirFactory(isLeaf isLeafFunc, treeWalkIgnoredErrs []error, disks ...Sto
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
entries, err = disk.ListDir(bucket, prefixDir)
|
entries, err = disk.ListDir(bucket, prefixDir)
|
||||||
if err == nil {
|
if err != nil {
|
||||||
entries, delayIsLeaf = filterListEntries(bucket, prefixDir, entries, prefixEntry, isLeaf)
|
// For any reason disk was deleted or goes offline, continue
|
||||||
return entries, delayIsLeaf, nil
|
// and list from other disks if possible.
|
||||||
|
if isErrIgnored(err, treeWalkIgnoredErrs...) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
return nil, false, traceError(err)
|
||||||
}
|
}
|
||||||
// For any reason disk was deleted or goes offline, continue
|
|
||||||
// and list from other disks if possible.
|
entries, delayIsLeaf = filterListEntries(bucket, prefixDir, entries, prefixEntry, isLeaf)
|
||||||
if isErrIgnored(err, treeWalkIgnoredErrs...) {
|
return entries, delayIsLeaf, nil
|
||||||
continue
|
|
||||||
}
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
// Return error at the end.
|
// Nothing found in all disks
|
||||||
return nil, false, traceError(err)
|
return nil, false, nil
|
||||||
}
|
}
|
||||||
return listDir
|
return listDir
|
||||||
}
|
}
|
||||||
@ -73,10 +74,6 @@ func (xl xlObjects) listObjects(bucket, prefix, marker, delimiter string, maxKey
|
|||||||
}
|
}
|
||||||
// For any walk error return right away.
|
// For any walk error return right away.
|
||||||
if walkResult.err != nil {
|
if walkResult.err != nil {
|
||||||
// File not found is a valid case.
|
|
||||||
if errorCause(walkResult.err) == errFileNotFound {
|
|
||||||
return ListObjectsInfo{}, nil
|
|
||||||
}
|
|
||||||
return ListObjectsInfo{}, toObjectErr(walkResult.err, bucket, prefix)
|
return ListObjectsInfo{}, toObjectErr(walkResult.err, bucket, prefix)
|
||||||
}
|
}
|
||||||
entry := walkResult.entry
|
entry := walkResult.entry
|
||||||
|
@ -349,10 +349,6 @@ func (xl xlObjects) listMultipartUploads(bucket, prefix, keyMarker, uploadIDMark
|
|||||||
}
|
}
|
||||||
// For any walk error return right away.
|
// For any walk error return right away.
|
||||||
if walkResult.err != nil {
|
if walkResult.err != nil {
|
||||||
// File not found or Disk not found is a valid case.
|
|
||||||
if isErrIgnored(walkResult.err, xlTreeWalkIgnoredErrs...) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
return ListMultipartsInfo{}, err
|
return ListMultipartsInfo{}, err
|
||||||
}
|
}
|
||||||
entry := strings.TrimPrefix(walkResult.entry, retainSlash(bucket))
|
entry := strings.TrimPrefix(walkResult.entry, retainSlash(bucket))
|
||||||
|
Loading…
Reference in New Issue
Block a user