diff options
| author | chrislu <chris.lu@gmail.com> | 2025-10-26 13:58:38 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-10-26 13:58:38 -0700 |
| commit | 46ce3b98311aeb0ba433b32cc983303e059d4196 (patch) | |
| tree | 751443d9d0a116956a54ad3d7f265f071f524918 | |
| parent | fbb459ca4c4c694cbcec1b12a507097ec21f1711 (diff) | |
| download | seaweedfs-46ce3b98311aeb0ba433b32cc983303e059d4196.tar.xz seaweedfs-46ce3b98311aeb0ba433b32cc983303e059d4196.zip | |
fix shard directory
| -rw-r--r-- | weed/storage/disk_location_ec.go | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go index cc3469c73..c1966e37c 100644 --- a/weed/storage/disk_location_ec.go +++ b/weed/storage/disk_location_ec.go @@ -362,18 +362,11 @@ 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) - // Check both l.Directory (where shards normally are) and l.IdxDirectory (in case of manual moves) + // Shard files (.ec00 - .ec13) are always in l.Directory, not l.IdxDirectory for i := 0; i < erasure_coding.TotalShardsCount; i++ { - // Check in primary directory (l.Directory) shardFileName := baseFileName + erasure_coding.ToExt(i) fi, err := os.Stat(shardFileName) - // If not found in primary directory and IdxDirectory is different, check there too - if err != nil && l.Directory != l.IdxDirectory { - indexShardFileName := erasure_coding.EcShardFileName(collection, l.IdxDirectory, int(vid)) + erasure_coding.ToExt(i) - fi, err = os.Stat(indexShardFileName) - } - if err == nil { // Check if file has non-zero size if fi.Size() > 0 { @@ -440,9 +433,8 @@ 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) + // Remove all EC shard files (.ec00 ~ .ec13) from data directory for i := 0; i < erasure_coding.TotalShardsCount; i++ { - shardFileName := baseFileName + erasure_coding.ToExt(i) - removeFile(shardFileName, "EC shard file") + removeFile(baseFileName+erasure_coding.ToExt(i), "EC shard file") } } |
