When listing, do not count delete markers (#15689)

When limiting listing do not count delete, since they may be discarded.

Extend limit, since we may be discarding the forward-to marker.

Fix directories always being sent to resolve, since they didn't return as match.
This commit is contained in:
Klaus Post
2022-09-14 21:11:27 +02:00
committed by GitHub
parent 5c61c3ccdc
commit eee1ce305c
3 changed files with 31 additions and 12 deletions

View File

@@ -768,8 +768,8 @@ func (es *erasureSingle) listPathInner(ctx context.Context, o listPathOptions, r
var limit int
if o.Limit > 0 && o.StopDiskAtLimit {
// Over-read by 1 to know if we truncate results.
limit = o.Limit + 1
// Over-read by 2 to know if we truncate results and not reach false EOF.
limit = o.Limit + 2
}
ctxDone := ctx.Done()
@@ -842,9 +842,9 @@ func (er *erasureObjects) listPath(ctx context.Context, o listPathOptions, resul
}
var limit int
if o.Limit > 0 && o.StopDiskAtLimit {
// Over-read by 2 + 1 for every 16 in limit to give some space for resolver
// And know if we have truncated.
limit = o.Limit + 2 + (o.Limit / 16)
// Over-read by 4 + 1 for every 16 in limit to give some space for resolver,
// allow for truncating the list and know if we have more results.
limit = o.Limit + 4 + (o.Limit / 16)
}
ctxDone := ctx.Done()
return listPathRaw(ctx, listPathRawOptions{