From ac8c43fe9ca98e97c79921b04861a557bbddb31e Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 30 Oct 2023 14:42:11 -0700 Subject: [PATCH] fix: allow missing hot-tier accounting (#18345) --- cmd/tier.go | 2 -- cmd/xl-storage.go | 15 +++++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/cmd/tier.go b/cmd/tier.go index 67f69cbfc..391a07e10 100644 --- a/cmd/tier.go +++ b/cmd/tier.go @@ -67,8 +67,6 @@ const ( tierConfigFormat = 1 tierConfigV1 = 1 tierConfigVersion = 2 - - minioHotTier = "STANDARD" ) // tierConfigPath refers to remote tier config object name diff --git a/cmd/xl-storage.go b/cmd/xl-storage.go index a3b52e5ba..67981d475 100644 --- a/cmd/xl-storage.go +++ b/cmd/xl-storage.go @@ -42,6 +42,7 @@ import ( "github.com/klauspost/filepathx" "github.com/minio/madmin-go/v3" "github.com/minio/minio/internal/bucket/lifecycle" + "github.com/minio/minio/internal/config/storageclass" "github.com/minio/minio/internal/disk" xioutil "github.com/minio/minio/internal/ioutil" "github.com/minio/minio/internal/logger" @@ -550,6 +551,10 @@ func (s *xlStorage) NSScanner(ctx context.Context, cache dataUsageCache, updates } sizeS.tiers[tier.Name] = tierStats{} } + if sizeS.tiers != nil { + sizeS.tiers[storageclass.STANDARD] = tierStats{} + sizeS.tiers[storageclass.RRS] = tierStats{} + } done := globalScannerMetrics.time(scannerMetricApplyAll) objInfos, err := item.applyVersionActions(ctx, objAPI, fivs.Versions) @@ -588,7 +593,7 @@ func (s *xlStorage) NSScanner(ctx context.Context, cache dataUsageCache, updates } tier := oi.StorageClass if tier == "" { - tier = minioHotTier + tier = storageclass.STANDARD // no SC means "STANDARD" } if oi.TransitionedObject.Status == lifecycle.TransitionComplete { tier = oi.TransitionedObject.Tier @@ -618,11 +623,9 @@ func (s *xlStorage) NSScanner(ctx context.Context, cache dataUsageCache, updates res["versions"] = strconv.FormatUint(sizeS.versions, 10) } res["size"] = strconv.FormatInt(sizeS.totalSize, 10) - if len(sizeS.tiers) > 0 { - for name, tier := range sizeS.tiers { - res["tier-size-"+name] = strconv.FormatUint(tier.TotalSize, 10) - res["tier-versions-"+name] = strconv.Itoa(tier.NumVersions) - } + for name, tier := range sizeS.tiers { + res["tier-size-"+name] = strconv.FormatUint(tier.TotalSize, 10) + res["tier-versions-"+name] = strconv.Itoa(tier.NumVersions) } if sizeS.failedCount > 0 { res["repl-failed"] = fmt.Sprintf("%d versions, %d bytes", sizeS.failedCount, sizeS.failedSize)