aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeyed Mahdi Sadegh Shobeiri <36403983+SmsS4@users.noreply.github.com>2024-03-06 18:58:46 +0330
committerGitHub <noreply@github.com>2024-03-06 07:28:46 -0800
commitecc154fa9e9bd11f2a664d2d11bd15c76d8b6c49 (patch)
treeb849cae0bd2af2f1fb5de89910edc3b08fe39b11
parent3e3e0fa2402ee29aabf523dc20aa5cfd5b22d569 (diff)
downloadseaweedfs-ecc154fa9e9bd11f2a664d2d11bd15c76d8b6c49.tar.xz
seaweedfs-ecc154fa9e9bd11f2a664d2d11bd15c76d8b6c49.zip
Add deleted bytes to total_disk_size (#5161)
-rw-r--r--weed/storage/store.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/weed/storage/store.go b/weed/storage/store.go
index d290909f1..782eb5b79 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -251,6 +251,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
maxVolumeCounts := make(map[string]uint32)
var maxFileKey NeedleId
collectionVolumeSize := make(map[string]int64)
+ collectionVolumeDeletedBytes := make(map[string]int64)
collectionVolumeReadOnlyCount := make(map[string]map[string]uint8)
for _, location := range s.Locations {
var deleteVids []needle.VolumeId
@@ -283,9 +284,11 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
if _, exist := collectionVolumeSize[v.Collection]; !exist {
collectionVolumeSize[v.Collection] = 0
+ collectionVolumeDeletedBytes[v.Collection] = 0
}
if !shouldDeleteVolume {
collectionVolumeSize[v.Collection] += int64(volumeMessage.Size)
+ collectionVolumeDeletedBytes[v.Collection] += int64(volumeMessage.DeletedByteCount)
} else {
collectionVolumeSize[v.Collection] -= int64(volumeMessage.Size)
if collectionVolumeSize[v.Collection] <= 0 {
@@ -342,6 +345,10 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
stats.VolumeServerDiskSizeGauge.WithLabelValues(col, "normal").Set(float64(size))
}
+ for col, deletedBytes := range collectionVolumeDeletedBytes{
+ stats.VolumeServerDiskSizeGauge.WithLabelValues(col, "deleted_bytes").Set(float64(deletedBytes))
+ }
+
for col, types := range collectionVolumeReadOnlyCount {
for t, count := range types {
stats.VolumeServerReadOnlyVolumeGauge.WithLabelValues(col, t).Set(float64(count))