From 4ec6eab004ff500b849f10f1985e83ce0855c70c Mon Sep 17 00:00:00 2001 From: chrislu Date: Thu, 19 Sep 2024 09:13:08 -0700 Subject: [PATCH] fix max volume count auto setting related to https://github.com/seaweedfs/seaweedfs/issues/6041#issuecomment-2360448182 --- weed/storage/store.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 }