mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 21:57:23 +08:00
reduce locks
This commit is contained in:
@@ -206,11 +206,12 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||
maxVolumeCount = maxVolumeCount + location.MaxVolumeCount
|
||||
location.volumesLock.RLock()
|
||||
for _, v := range location.volumes {
|
||||
if maxFileKey < v.MaxFileKey() {
|
||||
maxFileKey = v.MaxFileKey()
|
||||
curMaxFileKey, volumeMessage := v.ToVolumeInformationMessage()
|
||||
if maxFileKey < curMaxFileKey {
|
||||
maxFileKey = curMaxFileKey
|
||||
}
|
||||
if !v.expired(s.GetVolumeSizeLimit()) {
|
||||
volumeMessages = append(volumeMessages, v.ToVolumeInformationMessage())
|
||||
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)
|
||||
@@ -218,8 +219,7 @@ func (s *Store) CollectHeartbeat() *master_pb.Heartbeat {
|
||||
glog.V(0).Infoln("volume", v.Id, "is expired.")
|
||||
}
|
||||
}
|
||||
fileSize, _, _ := v.FileStat()
|
||||
collectionVolumeSize[v.Collection] += fileSize
|
||||
collectionVolumeSize[v.Collection] += volumeMessage.Size
|
||||
if v.IsReadOnly() {
|
||||
collectionVolumeReadOnlyCount[v.Collection] += 1
|
||||
}
|
||||
|
Reference in New Issue
Block a user