|
|
|
@ -230,7 +230,7 @@ func (l *DiskLocation) loadAllEcShards() (err error) { |
|
|
|
continue |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Check for orphaned EC shards without .ecx file (incomplete EC encoding)
|
|
|
|
// This happens when encoding is interrupted after writing shards but before writing .ecx
|
|
|
|
@ -305,11 +305,13 @@ func (l *DiskLocation) validateEcVolume(collection string, vid needle.VolumeId) |
|
|
|
// Count existing EC shard files
|
|
|
|
for i := 0; i < erasure_coding.TotalShardsCount; i++ { |
|
|
|
shardFileName := baseFileName + erasure_coding.ToExt(i) |
|
|
|
if util.FileExists(shardFileName) { |
|
|
|
if fi, err := os.Stat(shardFileName); err == nil { |
|
|
|
// Check if file has non-zero size
|
|
|
|
if fi, err := os.Stat(shardFileName); err == nil && fi.Size() > 0 { |
|
|
|
if fi.Size() > 0 { |
|
|
|
shardCount++ |
|
|
|
} |
|
|
|
} else if !os.IsNotExist(err) { |
|
|
|
glog.Warningf("Failed to stat shard file %s: %v", shardFileName, err) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -343,7 +345,7 @@ func (l *DiskLocation) removeEcVolumeFiles(collection string, vid needle.VolumeI |
|
|
|
glog.Warningf("Failed to remove incomplete EC shard file %s: %v", shardFileName, err) |
|
|
|
} |
|
|
|
} else { |
|
|
|
glog.V(0).Infof("Removed incomplete EC shard file: %s", shardFileName) |
|
|
|
glog.V(2).Infof("Removed incomplete EC shard file: %s", shardFileName) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -353,13 +355,13 @@ func (l *DiskLocation) removeEcVolumeFiles(collection string, vid needle.VolumeI |
|
|
|
glog.Warningf("Failed to remove incomplete EC index file %s.ecx: %v", indexBaseFileName, err) |
|
|
|
} |
|
|
|
} else { |
|
|
|
glog.V(0).Infof("Removed incomplete EC index file: %s.ecx", indexBaseFileName) |
|
|
|
glog.V(2).Infof("Removed incomplete EC index file: %s.ecx", indexBaseFileName) |
|
|
|
} |
|
|
|
if err := os.Remove(indexBaseFileName + ".ecj"); err != nil { |
|
|
|
if !os.IsNotExist(err) { |
|
|
|
glog.Warningf("Failed to remove incomplete EC journal file %s.ecj: %v", indexBaseFileName, err) |
|
|
|
} |
|
|
|
} else { |
|
|
|
glog.V(0).Infof("Removed incomplete EC journal file: %s.ecj", indexBaseFileName) |
|
|
|
glog.V(2).Infof("Removed incomplete EC journal file: %s.ecj", indexBaseFileName) |
|
|
|
} |
|
|
|
} |