s3: Fix early listing stopping when ILM is enabled (#472) (#21246)

S3 listing call is usually sent with a 'max-keys' parameter. This
'max-keys' will also be passed to WalkDir() call. However, when ILM is
enabled in a bucket and some objects are skipped, the listing can
return IsTruncated set to false even if there are more entries in
the drives.

The reason is that drives stop feeding the listing code because it has
max-keys parameter and the listing code thinks listing is finished
because it is being fed anymore.

Ask the drives to not stop listing and relies on the context
cancellation to stop listing in the drives as fast as possible.
This commit is contained in:
Anis Eleuch
2025-05-26 08:06:43 +01:00
committed by GitHub
parent 9ebe168782
commit 2c7fe094d1
5 changed files with 168 additions and 34 deletions

View File

@@ -223,7 +223,11 @@ func (z *erasureServerPools) listPath(ctx context.Context, o *listPathOptions) (
go func(o listPathOptions) {
defer wg.Done()
o.StopDiskAtLimit = true
if o.Lifecycle == nil {
// No filtering ahead, ask drives to stop
// listing exactly at a specific limit.
o.StopDiskAtLimit = true
}
listErr = z.listMerged(listCtx, o, filterCh)
o.debugln("listMerged returned with", listErr)
}(*o)
@@ -422,6 +426,9 @@ func (z *erasureServerPools) listAndSave(ctx context.Context, o *listPathOptions
go func() {
var returned bool
for entry := range inCh {
if o.shouldSkip(ctx, entry) {
continue
}
if !returned {
funcReturnedMu.Lock()
returned = funcReturned