From cdab4a3b85d7d69e8ca4e0e4fd32e8a08671b3d7 Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Wed, 16 Feb 2022 17:29:12 -0800 Subject: [PATCH] Update hourly tier-stats only on succesful tiering (#14330) --- cmd/bucket-lifecycle.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cmd/bucket-lifecycle.go b/cmd/bucket-lifecycle.go index 6fdd3b2cb..580c948c7 100644 --- a/cmd/bucket-lifecycle.go +++ b/cmd/bucket-lifecycle.go @@ -221,17 +221,18 @@ func (t *transitionState) worker(ctx context.Context, objectAPI ObjectLayer) { var err error if tier, err = transitionObject(ctx, objectAPI, oi); err != nil { logger.LogIf(ctx, fmt.Errorf("Transition failed for %s/%s version:%s with %w", oi.Bucket, oi.Name, oi.VersionID, err)) + } else { + ts := tierStats{ + TotalSize: uint64(oi.Size), + NumVersions: 1, + } + if oi.IsLatest { + ts.NumObjects = 1 + } + t.addLastDayStats(tier, ts) } atomic.AddInt32(&t.activeTasks, -1) - ts := tierStats{ - TotalSize: uint64(oi.Size), - NumVersions: 1, - } - if oi.IsLatest { - ts.NumObjects = 1 - } - t.addLastDayStats(tier, ts) } } }