|
|
|
@ -233,7 +233,6 @@ func (l *DiskLocation) loadAllEcShards() (err error) { |
|
|
|
if len(sameVolumeShards) > 0 && prevVolumeId != 0 { |
|
|
|
// We have collected EC shards but never found .ecx file
|
|
|
|
// Need to determine the collection name from the shard filenames
|
|
|
|
if len(sameVolumeShards) > 0 { |
|
|
|
baseName := sameVolumeShards[0][:len(sameVolumeShards[0])-len(path.Ext(sameVolumeShards[0]))] |
|
|
|
collection, volumeId, err := parseCollectionVolumeId(baseName) |
|
|
|
if err == nil && volumeId == prevVolumeId { |
|
|
|
@ -247,7 +246,6 @@ func (l *DiskLocation) loadAllEcShards() (err error) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
} |
|
|
|
@ -336,16 +334,28 @@ func (l *DiskLocation) removeEcVolumeFiles(collection string, vid needle.VolumeI |
|
|
|
// Remove all EC shard files (.ec00 ~ .ec13)
|
|
|
|
for i := 0; i < erasure_coding.TotalShardsCount; i++ { |
|
|
|
shardFileName := baseFileName + erasure_coding.ToExt(i) |
|
|
|
if err := os.Remove(shardFileName); err == nil { |
|
|
|
if err := os.Remove(shardFileName); err != nil { |
|
|
|
if !os.IsNotExist(err) { |
|
|
|
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) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Remove index files
|
|
|
|
if err := os.Remove(indexBaseFileName + ".ecx"); err == nil { |
|
|
|
if err := os.Remove(indexBaseFileName + ".ecx"); err != nil { |
|
|
|
if !os.IsNotExist(err) { |
|
|
|
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) |
|
|
|
} |
|
|
|
if err := os.Remove(indexBaseFileName + ".ecj"); err == nil { |
|
|
|
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) |
|
|
|
} |
|
|
|
} |