aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2024-09-19 09:13:08 -0700
committerchrislu <chris.lu@gmail.com>2024-09-19 09:13:08 -0700
commit4ec6eab004ff500b849f10f1985e83ce0855c70c (patch)
tree139dea2cf57b2e34ba0b057fcd0d45465747036a
parenta3572999bbf7cd9a06f0d8bade587b138afb3892 (diff)
downloadseaweedfs-4ec6eab004ff500b849f10f1985e83ce0855c70c.tar.xz
seaweedfs-4ec6eab004ff500b849f10f1985e83ce0855c70c.zip
fix max volume count auto setting
related to https://github.com/seaweedfs/seaweedfs/issues/6041#issuecomment-2360448182
-rw-r--r--weed/storage/store.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/weed/storage/store.go b/weed/storage/store.go
index 2d9ecbe32..64d424829 100644
--- a/weed/storage/store.go
+++ b/weed/storage/store.go
@@ -620,7 +620,8 @@ func (s *Store) MaybeAdjustVolumeMax() (hasChanges bool) {
unusedSpace := diskLocation.UnUsedSpace(volumeSizeLimit)
unclaimedSpaces := int64(diskStatus.Free) - int64(unusedSpace)
volCount := diskLocation.VolumesLen()
- maxVolumeCount := int32(volCount)
+ ecShardCount := diskLocation.EcShardCount()
+ maxVolumeCount := int32(volCount) + int32((ecShardCount+erasure_coding.DataShardsCount)/erasure_coding.DataShardsCount)
if unclaimedSpaces > int64(volumeSizeLimit) {
maxVolumeCount += int32(uint64(unclaimedSpaces)/volumeSizeLimit) - 1
}