ensure error checking on windows

This commit is contained in:
Chris Lu 2020-03-10 13:33:26 -07:00
parent 88a110e67e
commit d3e1ef64b3

View file

@ -113,8 +113,14 @@ func (v *Volume) CommitCompact() error {
} }
} else { } else {
if runtime.GOOS == "windows" { if runtime.GOOS == "windows" {
os.RemoveAll(v.FileName() + ".dat") e = os.RemoveAll(v.FileName() + ".dat")
os.RemoveAll(v.FileName() + ".idx") if e != nil {
return e
}
e = os.RemoveAll(v.FileName() + ".idx")
if e != nil {
return e
}
} }
var e error var e error
if e = os.Rename(v.FileName()+".cpd", v.FileName()+".dat"); e != nil { if e = os.Rename(v.FileName()+".cpd", v.FileName()+".dat"); e != nil {
@ -414,7 +420,7 @@ func copyDataBasedOnIndexFile(srcDatName, srcIdxName, dstDatName, datIdxName str
return fmt.Errorf("cannot append needle: %s", err) return fmt.Errorf("cannot append needle: %s", err)
} }
newOffset += n.DiskSize(version) newOffset += n.DiskSize(version)
glog.V(3).Infoln("saving key", n.Id, "volume offset", offset, "=>", newOffset, "data_size", n.Size) glog.V(4).Infoln("saving key", n.Id, "volume offset", offset, "=>", newOffset, "data_size", n.Size)
return nil return nil
}) })