From c2c803dd30dbfa1b0be33e30559976c825d39546 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Wed, 19 May 2021 18:21:18 +0200 Subject: [PATCH] Fix list entry deduplication (#12325) File infos would always be the same. Add numversions as a final tiebreaker. --- cmd/metacache-server-pool.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/metacache-server-pool.go b/cmd/metacache-server-pool.go index 82532bf7b..1c408cd7e 100644 --- a/cmd/metacache-server-pool.go +++ b/cmd/metacache-server-pool.go @@ -189,11 +189,16 @@ func (z *erasureServerPools) listPath(ctx context.Context, o listPathOptions) (e if err != nil { return true } - oFIV, err := existing.fileInfo(o.Bucket) + oFIV, err := other.fileInfo(o.Bucket) if err != nil { return false } - return oFIV.ModTime.After(eFIV.ModTime) + // Replace if modtime is newer + if !oFIV.ModTime.Equal(eFIV.ModTime) { + return oFIV.ModTime.After(eFIV.ModTime) + } + // Use NumVersions as a final tiebreaker. + return oFIV.NumVersions > eFIV.NumVersions }) if entries.len() > o.Limit { allAtEOF = false