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.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
delete disk_size metrics when collection deleted
Evgeny Kuzhelev709c83716cbc
diff --git a/weed/storage/store.go b/weed/storage/store.goindex f833f1b151..8ab8b994cd 100644--- a/weed/storage/store.go+++ b/weed/storage/store.go@@ -101,6 +101,7 @@ func (s *Store) DeleteCollection(collection string) (e error) {if e != nil {return}+ stats.VolumeServerDiskSizeGauge.DeleteLabelValues(collection, "normal")// let the heartbeat send the list of volumes, instead of sending the deleted volume ids to DeletedVolumesChan}return@@ -240,19 +241,19 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {if maxFileKey < curMaxFileKey {maxFileKey = curMaxFileKey}- deleteVolume := false+ shouldDeleteVolume := falseif !v.expired(volumeMessage.Size, s.GetVolumeSizeLimit()) {volumeMessages = append(volumeMessages, volumeMessage)} else {if v.expiredLongEnough(MAX_TTL_VOLUME_REMOVAL_DELAY) {deleteVids = append(deleteVids, v.Id)- deleteVolume = true+ shouldDeleteVolume = true} else {glog.V(0).Infof("volume %d is expired", v.Id)}if v.lastIoError != nil {deleteVids = append(deleteVids, v.Id)- deleteVolume = true+ shouldDeleteVolume = trueglog.Warningf("volume %d has IO error: %v", v.Id, v.lastIoError)}}@@ -260,12 +261,12 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {if _, exist := collectionVolumeSize[v.Collection]; !exist {collectionVolumeSize[v.Collection] = 0}- if !deleteVolume {+ if !shouldDeleteVolume {collectionVolumeSize[v.Collection] += volumeMessage.Size} else {collectionVolumeSize[v.Collection] -= volumeMessage.Size- if collectionVolumeSize[v.Collection] <= 0 {- delete(collectionVolumeSize, v.Collection)+ if collectionVolumeSize[v.Collection] < 0 {+ collectionVolumeSize[v.Collection] = 0}}@@ -277,7 +278,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {"isDiskSpaceLow": 0,}}- if !deleteVolume && v.IsReadOnly() {+ if !shouldDeleteVolume && v.IsReadOnly() {collectionVolumeReadOnlyCount[v.Collection]["IsReadOnly"] += 1if v.noWriteOrDelete {collectionVolumeReadOnlyCount[v.Collection]["noWriteOrDelete"] += 1