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
Fix update of `SeaweedFS_volumeServer_volumes` gauge metrics when EC shards are unmounted (#6776)
Lisandro Pindddb0f0ae52b
diff --git a/weed/storage/erasure_coding/ec_shard.go b/weed/storage/erasure_coding/ec_shard.goindex 0a7f4d09a5..e55a9f6765 100644--- a/weed/storage/erasure_coding/ec_shard.go+++ b/weed/storage/erasure_coding/ec_shard.go@@ -45,11 +45,19 @@ func NewEcVolumeShard(diskType types.DiskType, dirname string, collection string}v.ecdFileSize = ecdFi.Size()- stats.VolumeServerVolumeGauge.WithLabelValues(v.Collection, "ec_shards").Inc()+ v.Mount()return}+func (shard *EcVolumeShard) Mount() {+ stats.VolumeServerVolumeGauge.WithLabelValues(shard.Collection, "ec_shards").Inc()+}++func (shard *EcVolumeShard) Unmount() {+ stats.VolumeServerVolumeGauge.WithLabelValues(shard.Collection, "ec_shards").Dec()+}+func (shard *EcVolumeShard) Size() int64 {return shard.ecdFileSize}@@ -88,8 +96,8 @@ func (shard *EcVolumeShard) Close() {}func (shard *EcVolumeShard) Destroy() {+ shard.Unmount()os.Remove(shard.FileName() + ToExt(int(shard.ShardId)))- stats.VolumeServerVolumeGauge.WithLabelValues(shard.Collection, "ec_shards").Dec()}func (shard *EcVolumeShard) ReadAt(buf []byte, offset int64) (int, error) {diff --git a/weed/storage/erasure_coding/ec_volume.go b/weed/storage/erasure_coding/ec_volume.goindex f0b6627527..b3744807a5 100644--- a/weed/storage/erasure_coding/ec_volume.go+++ b/weed/storage/erasure_coding/ec_volume.go@@ -111,7 +111,7 @@ func (ev *EcVolume) DeleteEcVolumeShard(shardId ShardId) (ecVolumeShard *EcVolum}ecVolumeShard = ev.Shards[foundPosition]-+ ecVolumeShard.Unmount()ev.Shards = append(ev.Shards[:foundPosition], ev.Shards[foundPosition+1:]...)return ecVolumeShard, true}