s3: Fix wrong continuation token during listing with ILM enabled bucket (#20113)

This commit is contained in:
Anis Eleuch 2024-07-18 21:37:34 +01:00 committed by GitHub
parent 2e5d792f0c
commit d9ee668b6d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 8 deletions

View File

@ -1526,15 +1526,13 @@ func (z *erasureServerPools) listObjectsGeneric(ctx context.Context, bucket, pre
loi.NextMarker = last.Name loi.NextMarker = last.Name
} }
if merged.lastSkippedEntry != "" { if loi.IsTruncated && merged.lastSkippedEntry > loi.NextMarker {
if merged.lastSkippedEntry > loi.NextMarker { // An object hidden by ILM was found during a truncated listing. Since the number of entries
// An object hidden by ILM was found during listing. Since the number of entries // fetched from drives is limited by max-keys, we should use the last ILM filtered entry
// fetched from drives is limited, set IsTruncated to true to ask the s3 client // as a continuation token if it is lexially higher than the last visible object so that the
// to continue listing if it wishes in order to find if there is more objects. // next call of WalkDir() with the max-keys can reach new objects not seen previously.
loi.IsTruncated = true
loi.NextMarker = merged.lastSkippedEntry loi.NextMarker = merged.lastSkippedEntry
} }
}
if loi.NextMarker != "" { if loi.NextMarker != "" {
loi.NextMarker = opts.encodeMarker(loi.NextMarker) loi.NextMarker = opts.encodeMarker(loi.NextMarker)