fix: ListObjectVersions should return ordered Version & DeleteMarker (#9959)

The S3 specification says that versions are ordered in the response of
list object versions.

mc snapshot needs this to know which version comes first especially when
two versions have the same exact last-modified field.
This commit is contained in:
Anis Elleuch
2020-07-03 17:15:44 +01:00
committed by GitHub
parent 810a4f0723
commit 21a37e3393
8 changed files with 22 additions and 72 deletions

View File

@@ -409,12 +409,9 @@ func (s *xlStorage) CrawlAndGetDataUsage(ctx context.Context, cache dataUsageCac
var totalSize int64
for _, version := range fivs.Versions {
size := item.applyActions(ctx, objAPI, actionMeta{oi: version.ToObjectInfo(item.bucket, item.objectPath())})
totalSize += size
}
// Delete markers have no size, nothing to do here.
for _, deleted := range fivs.Deleted {
item.applyActions(ctx, objAPI, actionMeta{oi: deleted.ToObjectInfo(item.bucket, item.objectPath())})
if !version.Deleted {
totalSize += size
}
}
return totalSize, nil