aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2025-08-02 02:31:28 -0700
committerchrislu <chris.lu@gmail.com>2025-08-02 02:31:28 -0700
commit6d002c5d435978c2b821a14a58134f125f666aa6 (patch)
treeaf0c4b4f2081b4ce44a09315f27de4a7e66fa5d3
parent396927d1ec11fb36f1741fdbf1da879c2438cdf3 (diff)
downloadseaweedfs-origin/detect-and-plan-ec-tasks.tar.xz
seaweedfs-origin/detect-and-plan-ec-tasks.zip
fix hard coded erasure_coding valuesorigin/detect-and-plan-ec-tasks
-rw-r--r--weed/storage/erasure_coding/ec_encoder.go1
-rw-r--r--weed/worker/tasks/erasure_coding/detection.go7
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