From 503b6f274417128e818d801db49a5a373676610e Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Sun, 26 Apr 2026 22:31:56 -0700 Subject: [PATCH] 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. --- seaweed-volume/src/storage/store.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/seaweed-volume/src/storage/store.rs b/seaweed-volume/src/storage/store.rs index 3c2cc4328..7fcadf48c 100644 --- a/seaweed-volume/src/storage/store.rs +++ b/seaweed-volume/src/storage/store.rs @@ -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;