diff --git a/weed/server/volume_grpc_erasure_coding.go b/weed/server/volume_grpc_erasure_coding.go index e929351f6..522432dde 100644 --- a/weed/server/volume_grpc_erasure_coding.go +++ b/weed/server/volume_grpc_erasure_coding.go @@ -454,7 +454,8 @@ func (vs *VolumeServer) VolumeEcShardsToVolume(ctx context.Context, req *volume_ glog.V(0).Infof("VolumeEcShardsToVolume: %v", req) // Collect all EC shards (NewEcVolume will load EC config from .vif into v.ECContext) - tempShards := make([]string, erasure_coding.TotalShardsCount) + // Use MaxShardCount (32) to support custom EC ratios up to 32 total shards + tempShards := make([]string, erasure_coding.MaxShardCount) v, found := vs.store.CollectEcShards(needle.VolumeId(req.VolumeId), tempShards) if !found { return nil, fmt.Errorf("ec volume %d not found", req.VolumeId) diff --git a/weed/storage/erasure_coding/ec_volume_info.go b/weed/storage/erasure_coding/ec_volume_info.go index 53b352168..cd196084a 100644 --- a/weed/storage/erasure_coding/ec_volume_info.go +++ b/weed/storage/erasure_coding/ec_volume_info.go @@ -118,6 +118,10 @@ func (ecInfo *EcVolumeInfo) ToVolumeEcShardInformationMessage() (ret *master_pb. type ShardBits uint32 // use bits to indicate the shard id, use 32 bits just for possible future extension +const ( + MaxShardCount = 32 // Maximum number of shards since ShardBits is uint32 (bits 0-31) +) + func (b ShardBits) AddShardId(id ShardId) ShardBits { return b | (1 << id) }