mirror of
https://github.com/distribution/distribution.git
synced 2025-08-20 07:45:33 +00:00
s3: don't use s3.ListObjectsV2Output.KeyCount
This commit is contained in:
parent
6255476b3b
commit
a10b3a9ab4
@ -1105,15 +1105,17 @@ func (d *driver) doWalk(parentCtx context.Context, objectCount *int64, path, pre
|
|||||||
|
|
||||||
var count int64
|
var count int64
|
||||||
// KeyCount was introduced with version 2 of the GET Bucket operation in S3.
|
// KeyCount was introduced with version 2 of the GET Bucket operation in S3.
|
||||||
// Some S3 implementations don't support V2 now, so we fall back to manual
|
// Some s3 implementations (looking at you ceph/rgw) have a buggy
|
||||||
// calculation of the key count if required
|
// implementation so we intionally avoid ever using it, preferring instead
|
||||||
if objects.KeyCount != nil {
|
// to calculate the count from the Contents and CommonPrefixes fields of
|
||||||
count = *objects.KeyCount
|
// the s3.ListObjectsV2Output. we retain the commented out KeyCount code
|
||||||
*objectCount += *objects.KeyCount
|
// and this comment so as not to forget this problem moving forward.
|
||||||
} else {
|
//
|
||||||
count = int64(len(objects.Contents) + len(objects.CommonPrefixes))
|
// count = *objects.KeyCount
|
||||||
*objectCount += count
|
// *objectCount += *objects.KeyCount
|
||||||
}
|
|
||||||
|
count = int64(len(objects.Contents) + len(objects.CommonPrefixes))
|
||||||
|
*objectCount += count
|
||||||
|
|
||||||
walkInfos := make([]walkInfoContainer, 0, count)
|
walkInfos := make([]walkInfoContainer, 0, count)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user