diff options
| author | Lisandro Pin <lisandro.pin@proton.ch> | 2025-05-09 19:15:34 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-09 10:15:34 -0700 |
| commit | dddb0f0ae52b06469fb9e2e278af0616ac414f06 (patch) | |
| tree | f4a7a76b14557aa0ee63a766376a76f8d9ffdb34 /weed/storage/erasure_coding | |
| parent | d8cc26929434ff19f113a057d5c0d4092ee095ee (diff) | |
| download | seaweedfs-dddb0f0ae52b06469fb9e2e278af0616ac414f06.tar.xz seaweedfs-dddb0f0ae52b06469fb9e2e278af0616ac414f06.zip | |
Fix update of `SeaweedFS_volumeServer_volumes` gauge metrics when EC shards are unmounted (#6776)
Diffstat (limited to 'weed/storage/erasure_coding')
| -rw-r--r-- | weed/storage/erasure_coding/ec_shard.go | 12 | ||||
| -rw-r--r-- | weed/storage/erasure_coding/ec_volume.go | 2 |
2 files changed, 11 insertions, 3 deletions
diff --git a/weed/storage/erasure_coding/ec_shard.go b/weed/storage/erasure_coding/ec_shard.go index 0a7f4d09a..e55a9f676 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.go index f0b662752..b3744807a 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 } |
