mirror of https://github.com/minio/minio.git
Add single drive support for directory prefixes in Listing (#13829)
This fixes the compatibility issue with Hadoop 3.3.1 fixes #13710
This commit is contained in:
parent
f0fc77fded
commit
f6190d6751
|
@ -247,6 +247,21 @@ func listObjects(ctx context.Context, obj ObjectLayer, bucket, prefix, marker, d
|
||||||
return loi, nil
|
return loi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(prefix) > 0 && maxKeys == 1 && delimiter == "" && marker == "" {
|
||||||
|
// Optimization for certain applications like
|
||||||
|
// - Cohesity
|
||||||
|
// - Actifio, Splunk etc.
|
||||||
|
// which send ListObjects requests where the actual object
|
||||||
|
// itself is the prefix and max-keys=1 in such scenarios
|
||||||
|
// we can simply verify locally if such an object exists
|
||||||
|
// to avoid the need for ListObjects().
|
||||||
|
objInfo, err := obj.GetObjectInfo(ctx, bucket, prefix, ObjectOptions{NoLock: true})
|
||||||
|
if err == nil {
|
||||||
|
loi.Objects = append(loi.Objects, objInfo)
|
||||||
|
return loi, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// For delimiter and prefix as '/' we do not list anything at all
|
// For delimiter and prefix as '/' we do not list anything at all
|
||||||
// since according to s3 spec we stop at the 'delimiter'
|
// since according to s3 spec we stop at the 'delimiter'
|
||||||
// along // with the prefix. On a flat namespace with 'prefix'
|
// along // with the prefix. On a flat namespace with 'prefix'
|
||||||
|
@ -290,6 +305,13 @@ func listObjects(ctx context.Context, obj ObjectLayer, bucket, prefix, marker, d
|
||||||
i := i
|
i := i
|
||||||
walkResult, ok := <-walkResultCh
|
walkResult, ok := <-walkResultCh
|
||||||
if !ok {
|
if !ok {
|
||||||
|
if HasSuffix(prefix, SlashSeparator) {
|
||||||
|
objInfo, err := obj.GetObjectInfo(ctx, bucket, prefix, ObjectOptions{NoLock: true})
|
||||||
|
if err == nil {
|
||||||
|
loi.Objects = append(loi.Objects, objInfo)
|
||||||
|
return loi, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
// Closed channel.
|
// Closed channel.
|
||||||
eof = true
|
eof = true
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue