fix: allow missing hot-tier accounting (#18345)

This commit is contained in:
Harshavardhana 2023-10-30 14:42:11 -07:00 committed by GitHub
parent 4d40ee00e9
commit ac8c43fe9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

View File

@ -67,8 +67,6 @@ const (
tierConfigFormat = 1
tierConfigV1 = 1
tierConfigVersion = 2
minioHotTier = "STANDARD"
)
// tierConfigPath refers to remote tier config object name

View File

@ -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,12 +623,10 @@ 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)
}
}
if sizeS.failedCount > 0 {
res["repl-failed"] = fmt.Sprintf("%d versions, %d bytes", sizeS.failedCount, sizeS.failedSize)
}