diff options
| author | chrislu <chris.lu@gmail.com> | 2025-10-26 19:21:27 -0700 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-10-26 19:21:27 -0700 |
| commit | c6968ffd968e883bfad231700d829006b1a05c89 (patch) | |
| tree | c210c08ab10aaada77dd5ecc5097d8a2596bad43 | |
| parent | 2bcf65741f15f786e0cc95346fd2e0ab031f1156 (diff) | |
| download | seaweedfs-c6968ffd968e883bfad231700d829006b1a05c89.tar.xz seaweedfs-c6968ffd968e883bfad231700d829006b1a05c89.zip | |
grouping logic should be updated to use both collection and volumeId to ensure correctness
| -rw-r--r-- | weed/storage/disk_location_ec.go | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/weed/storage/disk_location_ec.go b/weed/storage/disk_location_ec.go index c1966e37c..8ba4339ce 100644 --- a/weed/storage/disk_location_ec.go +++ b/weed/storage/disk_location_ec.go @@ -170,6 +170,7 @@ func (l *DiskLocation) loadAllEcShards() (err error) { }) var sameVolumeShards []string var prevVolumeId needle.VolumeId + var prevCollection string for _, fileInfo := range dirEntries { if fileInfo.IsDir() { continue @@ -192,16 +193,18 @@ func (l *DiskLocation) loadAllEcShards() (err error) { // 0 byte files should be only appearing erroneously for ec data files // so we ignore them if re.MatchString(ext) && info.Size() > 0 { - if prevVolumeId == 0 || volumeId == prevVolumeId { + // Group shards by both collection and volumeId to avoid mixing collections + if prevVolumeId == 0 || (volumeId == prevVolumeId && collection == prevCollection) { sameVolumeShards = append(sameVolumeShards, fileInfo.Name()) } else { sameVolumeShards = []string{fileInfo.Name()} } prevVolumeId = volumeId + prevCollection = collection continue } - if ext == ".ecx" && volumeId == prevVolumeId { + if ext == ".ecx" && volumeId == prevVolumeId && collection == prevCollection { // Check if this is an incomplete EC encoding (not a distributed EC volume) // Key distinction: if .dat file still exists, EC encoding may have failed // If .dat file is gone, this is likely a distributed EC volume with shards on multiple servers @@ -211,6 +214,7 @@ func (l *DiskLocation) loadAllEcShards() (err error) { reset := func() { sameVolumeShards = nil prevVolumeId = 0 + prevCollection = "" } datExists := util.FileExists(datFileName) |
