aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLHHDZ <changlin.shi@ly.com>2023-07-11 14:37:33 +0800
committerGitHub <noreply@github.com>2023-07-10 23:37:33 -0700
commit3730772e05f075ccc921d49b5192d609784a84b5 (patch)
treea6a74d06fb7f8fd627d06e844ecd18e03a3c745f
parent6f7008958e60b14d4f277e3c69da7678604327d7 (diff)
downloadseaweedfs-3730772e05f075ccc921d49b5192d609784a84b5.tar.xz
seaweedfs-3730772e05f075ccc921d49b5192d609784a84b5.zip
refresh max volume count after adjust (#4662)
Signed-off-by: changlin.shi <changlin.shi@ly.com>
-rw-r--r--weed/storage/store.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/weed/storage/store.go b/weed/storage/store.go
index c7904c5c2..6b4467abc 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -576,6 +576,7 @@ func (s *Store) MaybeAdjustVolumeMax() (hasChanges bool) {
if volumeSizeLimit == 0 {
return
}
+ var newMaxVolumeCount int32
for _, diskLocation := range s.Locations {
if diskLocation.OriginalMaxVolumeCount == 0 {
currentMaxVolumeCount := atomic.LoadInt32(&diskLocation.MaxVolumeCount)
@@ -587,11 +588,15 @@ func (s *Store) MaybeAdjustVolumeMax() (hasChanges bool) {
if unclaimedSpaces > int64(volumeSizeLimit) {
maxVolumeCount += int32(uint64(unclaimedSpaces)/volumeSizeLimit) - 1
}
+ newMaxVolumeCount = newMaxVolumeCount + maxVolumeCount
atomic.StoreInt32(&diskLocation.MaxVolumeCount, maxVolumeCount)
glog.V(4).Infof("disk %s max %d unclaimedSpace:%dMB, unused:%dMB volumeSizeLimit:%dMB",
diskLocation.Directory, maxVolumeCount, unclaimedSpaces/1024/1024, unusedSpace/1024/1024, volumeSizeLimit/1024/1024)
hasChanges = hasChanges || currentMaxVolumeCount != atomic.LoadInt32(&diskLocation.MaxVolumeCount)
+ } else {
+ newMaxVolumeCount = newMaxVolumeCount + diskLocation.OriginalMaxVolumeCount
}
}
+ stats.VolumeServerMaxVolumeCounter.Set(float64(newMaxVolumeCount))
return
}