Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

s3: remove deleted collection during metrics reporting

chrislu4d72a1ce6e1c
diff --git a/weed/storage/store.go b/weed/storage/store.go
index d45b0d95ed..ae0cfb31b2 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -227,7 +227,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
var volumeMessages []*master_pb.VolumeInformationMessage
maxVolumeCounts := make(map[string]uint32)
var maxFileKey NeedleId
- collectionVolumeSize := make(map[string]uint64)
+ collectionVolumeSize := make(map[string]int64)
collectionVolumeReadOnlyCount := make(map[string]map[string]uint8)
for _, location := range s.Locations {
var deleteVids []needle.VolumeId
@@ -262,11 +262,11 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
collectionVolumeSize[v.Collection] = 0
}
if !shouldDeleteVolume {
- collectionVolumeSize[v.Collection] += volumeMessage.Size
+ collectionVolumeSize[v.Collection] += int64(volumeMessage.Size)
} else {
- collectionVolumeSize[v.Collection] -= volumeMessage.Size
- if collectionVolumeSize[v.Collection] < 0 {
- collectionVolumeSize[v.Collection] = 0
+ collectionVolumeSize[v.Collection] -= int64(volumeMessage.Size)
+ if collectionVolumeSize[v.Collection] <= 0 {
+ delete(collectionVolumeSize, v.Collection)
}
}