mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
Extend quorum based listing for prefixes (#5749)
Previous PR 2afd196c83
fixed
the issue of quorum based listing for regular objects, this
PR continues on this idea by extending this support to
object directory prefixes as well.
Fixes #5733
This commit is contained in:
parent
98315b8e60
commit
8eb838bf91
@ -725,27 +725,22 @@ func (s *xlSets) ListObjects(ctx context.Context, bucket, prefix, marker, delimi
|
|||||||
return result, toObjectErr(walkResult.err, bucket, prefix)
|
return result, toObjectErr(walkResult.err, bucket, prefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
entry := walkResult.entry
|
|
||||||
var objInfo ObjectInfo
|
var objInfo ObjectInfo
|
||||||
if hasSuffix(entry, slashSeparator) {
|
var err error
|
||||||
// Object name needs to be full path.
|
if hasSuffix(walkResult.entry, slashSeparator) {
|
||||||
objInfo.Bucket = bucket
|
objInfo, err = s.getHashedSet(walkResult.entry).getObjectInfoDir(bucket, walkResult.entry)
|
||||||
objInfo.Name = entry
|
|
||||||
objInfo.IsDir = true
|
|
||||||
} else {
|
} else {
|
||||||
// Set the Mode to a "regular" file.
|
objInfo, err = s.getHashedSet(walkResult.entry).getObjectInfo(bucket, walkResult.entry)
|
||||||
var err error
|
}
|
||||||
objInfo, err = s.getHashedSet(entry).getObjectInfo(bucket, entry)
|
if err != nil {
|
||||||
if err != nil {
|
// Ignore errFileNotFound as the object might have got
|
||||||
// Ignore errFileNotFound as the object might have got
|
// deleted in the interim period of listing and getObjectInfo(),
|
||||||
// deleted in the interim period of listing and getObjectInfo(),
|
// ignore quorum error as it might be an entry from an outdated disk.
|
||||||
// ignore quorum error as it might be an entry from an outdated disk.
|
switch errors.Cause(err) {
|
||||||
switch errors.Cause(err) {
|
case errFileNotFound, errXLReadQuorum:
|
||||||
case errFileNotFound, errXLReadQuorum:
|
continue
|
||||||
continue
|
|
||||||
}
|
|
||||||
return result, toObjectErr(err, bucket, prefix)
|
|
||||||
}
|
}
|
||||||
|
return result, toObjectErr(err, bucket, prefix)
|
||||||
}
|
}
|
||||||
nextMarker = objInfo.Name
|
nextMarker = objInfo.Name
|
||||||
objInfos = append(objInfos, objInfo)
|
objInfos = append(objInfos, objInfo)
|
||||||
@ -1270,23 +1265,19 @@ func (s *xlSets) listObjectsHeal(bucket, prefix, marker, delimiter string, maxKe
|
|||||||
if walkResult.err != nil {
|
if walkResult.err != nil {
|
||||||
return loi, toObjectErr(walkResult.err, bucket, prefix)
|
return loi, toObjectErr(walkResult.err, bucket, prefix)
|
||||||
}
|
}
|
||||||
entry := walkResult.entry
|
|
||||||
var objInfo ObjectInfo
|
var objInfo ObjectInfo
|
||||||
if hasSuffix(entry, slashSeparator) {
|
var err error
|
||||||
// Object name needs to be full path.
|
if hasSuffix(walkResult.entry, slashSeparator) {
|
||||||
objInfo.Bucket = bucket
|
objInfo, err = s.getHashedSet(walkResult.entry).getObjectInfoDir(bucket, walkResult.entry)
|
||||||
objInfo.Name = entry
|
|
||||||
objInfo.IsDir = true
|
|
||||||
} else {
|
} else {
|
||||||
var err error
|
objInfo, err = s.getHashedSet(walkResult.entry).getObjectInfo(bucket, walkResult.entry)
|
||||||
objInfo, err = s.getHashedSet(entry).getObjectInfo(bucket, entry)
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Ignore errFileNotFound
|
// Ignore errFileNotFound
|
||||||
if errors.Cause(err) == errFileNotFound {
|
if errors.Cause(err) == errFileNotFound {
|
||||||
continue
|
continue
|
||||||
}
|
|
||||||
return loi, toObjectErr(err, bucket, prefix)
|
|
||||||
}
|
}
|
||||||
|
return loi, toObjectErr(err, bucket, prefix)
|
||||||
}
|
}
|
||||||
nextMarker = objInfo.Name
|
nextMarker = objInfo.Name
|
||||||
objInfos = append(objInfos, objInfo)
|
objInfos = append(objInfos, objInfo)
|
||||||
|
Loading…
Reference in New Issue
Block a user