fix(seaweed-volume): ceil EC shard slots in maybe_adjust_volume_max (#9232)

Mirrors the volume-server side of seaweedfs/seaweedfs#9196: compute the
EC-shard contribution to maxVolumeCount with proper ceiling division
((N + D - 1) / D) instead of (N + D) / D, which over-counts by one slot
whenever the per-location EC-shard count is zero or an exact multiple of
DataShardsCount (10). The most common case -- a location with no EC
shards -- silently inflated maxVolumeCount by 1 on every recalculation.

The matching low-disk effective_max_count path in heartbeat.rs already
uses the correct ceiling form, and the master-side topology changes from
that PR have no Rust counterpart.
This commit is contained in:
Chris Lu
2026-04-26 22:31:56 -07:00
committed by GitHub
parent 21fadf5582
commit 503b6f2744
+2 -1
View File
@@ -492,7 +492,8 @@ impl Store {
let vol_count = loc.volumes_len() as i32;
let loc_ec_shards = loc.ec_shard_count();
let ec_equivalent = ((loc_ec_shards
+ crate::storage::erasure_coding::ec_shard::DATA_SHARDS_COUNT)
+ crate::storage::erasure_coding::ec_shard::DATA_SHARDS_COUNT
- 1)
/ crate::storage::erasure_coding::ec_shard::DATA_SHARDS_COUNT)
as i32;
let mut max_count = vol_count + ec_equivalent;