diff options
| author | Konstantin Lebedev <lebedev_k@tochka.com> | 2020-10-28 17:38:26 +0500 |
|---|---|---|
| committer | Konstantin Lebedev <lebedev_k@tochka.com> | 2020-10-28 17:38:26 +0500 |
| commit | 1ad1b8c4f63fd36912dd9844d45d8ff5dc0170b5 (patch) | |
| tree | c3778d75d9bc2eea4019a1ec1fe427af9c9c1bc4 /weed | |
| parent | 326fcdd86b5b787db690b6eee61d0aa8fe29e3eb (diff) | |
| download | seaweedfs-1ad1b8c4f63fd36912dd9844d45d8ff5dc0170b5.tar.xz seaweedfs-1ad1b8c4f63fd36912dd9844d45d8ff5dc0170b5.zip | |
collection Volume ReadOnly Count with detailed status
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/storage/store.go | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/weed/storage/store.go b/weed/storage/store.go index b9fcfcba9..3a8c07e6e 100644 --- a/weed/storage/store.go +++ b/weed/storage/store.go @@ -200,7 +200,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat { maxVolumeCount := 0 var maxFileKey NeedleId collectionVolumeSize := make(map[string]uint64) - collectionVolumeReadOnlyCount := make(map[string]uint8) + collectionVolumeReadOnlyCount := make(map[string]map[string]uint8) for _, location := range s.Locations { var deleteVids []needle.VolumeId maxVolumeCount = maxVolumeCount + location.MaxVolumeCount @@ -220,11 +220,25 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat { } } collectionVolumeSize[v.Collection] += volumeMessage.Size + if _, exist := collectionVolumeReadOnlyCount[v.Collection]; !exist { + collectionVolumeReadOnlyCount[v.Collection] = map[string]uint8{ + "IsReadOnly": 0, + "noWriteOrDelete": 0, + "noWriteCanDelete": 0, + "isDiskSpaceLow": 0, + } + } if v.IsReadOnly() { - collectionVolumeReadOnlyCount[v.Collection] += 1 - } else { - if _, exist := collectionVolumeReadOnlyCount[v.Collection]; !exist { - collectionVolumeReadOnlyCount[v.Collection] = 0 + collectionVolumeReadOnlyCount[v.Collection] = make(map[string]uint8) + collectionVolumeReadOnlyCount[v.Collection]["IsReadOnly"] += 1 + if v.noWriteOrDelete { + collectionVolumeReadOnlyCount[v.Collection]["noWriteOrDelete"] += 1 + } + if v.noWriteCanDelete { + collectionVolumeReadOnlyCount[v.Collection]["noWriteCanDelete"] += 1 + } + if v.location.isDiskSpaceLow { + collectionVolumeReadOnlyCount[v.Collection]["isDiskSpaceLow"] += 1 } } } @@ -251,8 +265,10 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat { stats.VolumeServerDiskSizeGauge.WithLabelValues(col, "normal").Set(float64(size)) } - for col, count := range collectionVolumeReadOnlyCount { - stats.VolumeServerReadOnlyVolumeGauge.WithLabelValues(col, "normal").Set(float64(count)) + for col, types := range collectionVolumeReadOnlyCount { + for t, count := range types { + stats.VolumeServerReadOnlyVolumeGauge.WithLabelValues(col, t).Set(float64(count)) + } } return &master_pb.Heartbeat{ |
