diff options
| author | FQHSLycopene <110231817+FQHSLycopene@users.noreply.github.com> | 2025-07-29 03:24:56 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-28 12:24:56 -0700 |
| commit | e1f8da0db3d73421c6bfc429a93672d32b5875da (patch) | |
| tree | e4755a327fa40fe593d8062de2da706764f1f82c | |
| parent | 6a790b1ec13928c26c8d26b28a6d2253e19819a7 (diff) | |
| download | seaweedfs-e1f8da0db3d73421c6bfc429a93672d32b5875da.tar.xz seaweedfs-e1f8da0db3d73421c6bfc429a93672d32b5875da.zip | |
fix: consider EC shard count in volume.balance capacity calculation (#7034)
* fix: consider EC shard count in volume.balance capacity calculation
* update the implementation of capacityByMaxVolumeCount to include the EC shard usage
| -rw-r--r-- | weed/shell/command_volume_balance.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/weed/shell/command_volume_balance.go b/weed/shell/command_volume_balance.go index ac7dab3d9..b3c76a172 100644 --- a/weed/shell/command_volume_balance.go +++ b/weed/shell/command_volume_balance.go @@ -225,7 +225,11 @@ func capacityByMaxVolumeCount(diskType types.DiskType) CapacityFunc { if !found { return 0 } - return float64(diskInfo.MaxVolumeCount) + var ecShardCount int + for _, ecShardInfo := range diskInfo.EcShardInfos { + ecShardCount += erasure_coding.ShardBits(ecShardInfo.EcIndexBits).ShardIdCount() + } + return float64(diskInfo.MaxVolumeCount) - float64(ecShardCount)/erasure_coding.DataShardsCount } } |
