From d9ee668b6d71972630d7e13f1d18ac0873a233d3 Mon Sep 17 00:00:00 2001 From: Anis Eleuch Date: Thu, 18 Jul 2024 21:37:34 +0100 Subject: [PATCH] s3: Fix wrong continuation token during listing with ILM enabled bucket (#20113) --- cmd/erasure-server-pool.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/cmd/erasure-server-pool.go b/cmd/erasure-server-pool.go index 6fbaf9808..687b04f4d 100644 --- a/cmd/erasure-server-pool.go +++ b/cmd/erasure-server-pool.go @@ -1526,14 +1526,12 @@ func (z *erasureServerPools) listObjectsGeneric(ctx context.Context, bucket, pre loi.NextMarker = last.Name } - if merged.lastSkippedEntry != "" { - if merged.lastSkippedEntry > loi.NextMarker { - // An object hidden by ILM was found during listing. Since the number of entries - // fetched from drives is limited, set IsTruncated to true to ask the s3 client - // to continue listing if it wishes in order to find if there is more objects. - loi.IsTruncated = true - loi.NextMarker = merged.lastSkippedEntry - } + if loi.IsTruncated && merged.lastSkippedEntry > loi.NextMarker { + // An object hidden by ILM was found during a truncated listing. Since the number of entries + // fetched from drives is limited by max-keys, we should use the last ILM filtered entry + // as a continuation token if it is lexially higher than the last visible object so that the + // next call of WalkDir() with the max-keys can reach new objects not seen previously. + loi.NextMarker = merged.lastSkippedEntry } if loi.NextMarker != "" {