aboutsummaryrefslogtreecommitdiff
path: root/weed/storage/disk_location_ec.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/storage/disk_location_ec.go')
-rw-r--r--weed/storage/disk_location_ec.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go
index 128bfd26f..b370555da 100644
--- a/weed/storage/disk_location_ec.go
+++ b/weed/storage/disk_location_ec.go
@@ -16,7 +16,9 @@ import (
)
var (
- re = regexp.MustCompile(`\.ec[0-9][0-9]`)
+ // Match .ec00 through .ec999 (currently only .ec00-.ec31 are used)
+ // Using \d{2,3} for future-proofing if MaxShardCount is ever increased beyond 99
+ re = regexp.MustCompile(`\.ec\d{2,3}`)
)
func (l *DiskLocation) FindEcVolume(vid needle.VolumeId) (*erasure_coding.EcVolume, bool) {
@@ -398,8 +400,8 @@ func (l *DiskLocation) validateEcVolume(collection string, vid needle.VolumeId)
var actualShardSize int64 = -1
// Count shards and validate they all have the same size (required for Reed-Solomon EC)
- // Shard files (.ec00 - .ec13) are always in l.Directory, not l.IdxDirectory
- for i := 0; i < erasure_coding.TotalShardsCount; i++ {
+ // Check up to MaxShardCount (32) to support custom EC ratios
+ for i := 0; i < erasure_coding.MaxShardCount; i++ {
shardFileName := baseFileName + erasure_coding.ToExt(i)
fi, err := os.Stat(shardFileName)
@@ -472,8 +474,9 @@ func (l *DiskLocation) removeEcVolumeFiles(collection string, vid needle.VolumeI
removeFile(indexBaseFileName+".ecx", "EC index file")
removeFile(indexBaseFileName+".ecj", "EC journal file")
- // Remove all EC shard files (.ec00 ~ .ec13) from data directory
- for i := 0; i < erasure_coding.TotalShardsCount; i++ {
+ // Remove all EC shard files (.ec00 ~ .ec31) from data directory
+ // Use MaxShardCount (32) to support custom EC ratios
+ for i := 0; i < erasure_coding.MaxShardCount; i++ {
removeFile(baseFileName+erasure_coding.ToExt(i), "EC shard file")
}
}