From 11593c6cc41599d0018e5e3b8af51eae08f26ae9 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Fri, 24 Jul 2020 11:02:10 -0700 Subject: [PATCH] Usage: Reset merged info when updating (#10126) When merging multiple buckets reset between each update. Avoids merging the same usage metrics multiple times resulting in duplicate data entries. --- cmd/erasure-zones.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/erasure-zones.go b/cmd/erasure-zones.go index 116affbbb..41149bea2 100644 --- a/cmd/erasure-zones.go +++ b/cmd/erasure-zones.go @@ -340,12 +340,13 @@ func (z *erasureZones) CrawlAndGetDataUsage(ctx context.Context, bf *bloomFilter // We need to merge since we will get the same buckets from each zone. // Therefore to get the exact bucket sizes we must merge before we can convert. - allMerged := dataUsageCache{Info: dataUsageCacheInfo{Name: dataUsageRoot}} + var allMerged dataUsageCache update := func() { mu.Lock() defer mu.Unlock() + allMerged = dataUsageCache{Info: dataUsageCacheInfo{Name: dataUsageRoot}} for _, info := range results { if info.Info.LastUpdate.IsZero() { // Not filled yet.