From 56eb522b136966d38b257ade7da07479092ce12c Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 15 Jun 2021 21:11:31 -0700 Subject: [PATCH] fix stats when a collection is deleted --- weed/storage/store.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/weed/storage/store.go b/weed/storage/store.go index f27f2412f..6ff996a3c 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -250,6 +250,11 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat { } if !deleteVolume { collectionVolumeSize[v.Collection] += volumeMessage.Size + } else { + collectionVolumeSize[v.Collection] -= volumeMessage.Size + if collectionVolumeSize[v.Collection] <= 0 { + delete(collectionVolumeSize, v.Collection) + } } if _, exist := collectionVolumeReadOnlyCount[v.Collection]; !exist {