From 6d002c5d435978c2b821a14a58134f125f666aa6 Mon Sep 17 00:00:00 2001 From: chrislu Date: Sat, 2 Aug 2025 02:31:28 -0700 Subject: [PATCH] fix hard coded erasure_coding values --- weed/storage/erasure_coding/ec_encoder.go | 1 + weed/worker/tasks/erasure_coding/detection.go | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/weed/storage/erasure_coding/ec_encoder.go b/weed/storage/erasure_coding/ec_encoder.go index 5db65a2c8..eeeb156e6 100644 --- a/weed/storage/erasure_coding/ec_encoder.go +++ b/weed/storage/erasure_coding/ec_encoder.go @@ -18,6 +18,7 @@ const ( DataShardsCount = 10 ParityShardsCount = 4 TotalShardsCount = DataShardsCount + ParityShardsCount + MinTotalDisks = TotalShardsCount/ParityShardsCount + 1 ErasureCodingLargeBlockSize = 1024 * 1024 * 1024 // 1GB ErasureCodingSmallBlockSize = 1024 * 1024 // 1MB ) diff --git a/weed/worker/tasks/erasure_coding/detection.go b/weed/worker/tasks/erasure_coding/detection.go index b40298f81..c9de939f0 100644 --- a/weed/worker/tasks/erasure_coding/detection.go +++ b/weed/worker/tasks/erasure_coding/detection.go @@ -173,13 +173,10 @@ func planECDestinations(activeTopology *topology.ActiveTopology, metric *types.V } } - // Determine minimum shard disk locations based on configuration - minTotalDisks := 4 - // Get available disks for EC placement (include source node for EC) availableDisks := activeTopology.GetAvailableDisks(topology.TaskTypeErasureCoding, "") - if len(availableDisks) < minTotalDisks { - return nil, fmt.Errorf("insufficient disks for EC placement: need %d, have %d", minTotalDisks, len(availableDisks)) + if len(availableDisks) < erasure_coding.MinTotalDisks { + return nil, fmt.Errorf("insufficient disks for EC placement: need %d, have %d", erasure_coding.MinTotalDisks, len(availableDisks)) } // Select best disks for EC placement with rack/DC diversity