mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Merge pull request #1879 from qieqieplus/fix-stats
fix: collection stats won't update if all volumes expired at once
This commit is contained in:
commit
36e12ce6f5
|
@ -220,20 +220,30 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
|||
if maxFileKey < curMaxFileKey {
|
||||
maxFileKey = curMaxFileKey
|
||||
}
|
||||
deleteVolume := false
|
||||
if !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
|
||||
} else {
|
||||
glog.V(0).Infof("volume %d is expired", v.Id)
|
||||
}
|
||||
if v.lastIoError != nil {
|
||||
deleteVids = append(deleteVids, v.Id)
|
||||
deleteVolume = true
|
||||
glog.Warningf("volume %d has IO error: %v", v.Id, v.lastIoError)
|
||||
}
|
||||
}
|
||||
|
||||
if _, exist := collectionVolumeSize[v.Collection]; !exist {
|
||||
collectionVolumeSize[v.Collection] = 0
|
||||
}
|
||||
if !deleteVolume {
|
||||
collectionVolumeSize[v.Collection] += volumeMessage.Size
|
||||
}
|
||||
|
||||
if _, exist := collectionVolumeReadOnlyCount[v.Collection]; !exist {
|
||||
collectionVolumeReadOnlyCount[v.Collection] = map[string]uint8{
|
||||
"IsReadOnly": 0,
|
||||
|
@ -242,7 +252,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
|||
"isDiskSpaceLow": 0,
|
||||
}
|
||||
}
|
||||
if v.IsReadOnly() {
|
||||
if !deleteVolume && v.IsReadOnly() {
|
||||
collectionVolumeReadOnlyCount[v.Collection]["IsReadOnly"] += 1
|
||||
if v.noWriteOrDelete {
|
||||
collectionVolumeReadOnlyCount[v.Collection]["noWriteOrDelete"] += 1
|
||||
|
@ -267,7 +277,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
|||
glog.V(0).Infof("volume %d is deleted", vid)
|
||||
}
|
||||
} else {
|
||||
glog.V(0).Infof("delete volume %d: %v", vid, err)
|
||||
glog.Warningf("delete volume %d: %v", vid, err)
|
||||
}
|
||||
}
|
||||
location.volumesLock.Unlock()
|
||||
|
|
Loading…
Reference in a new issue