This commit is contained in:
Chris Lu
2019-03-25 09:16:12 -07:00
parent eaa42c3865
commit 70815e9124
10 changed files with 568 additions and 120 deletions

View File

@@ -38,7 +38,7 @@ func (v *Volume) Compact2() error {
return v.copyDataBasedOnIndexFile(filePath+".cpd", filePath+".cpx")
}
func (v *Volume) commitCompact() error {
func (v *Volume) CommitCompact() error {
glog.V(0).Infof("Committing volume %d vacuuming...", v.Id)
v.dataFileAccessLock.Lock()
defer v.dataFileAccessLock.Unlock()
@@ -53,7 +53,7 @@ func (v *Volume) commitCompact() error {
var e error
if e = v.makeupDiff(v.FileName()+".cpd", v.FileName()+".cpx", v.FileName()+".dat", v.FileName()+".idx"); e != nil {
glog.V(0).Infof("makeupDiff in commitCompact volume %d failed %v", v.Id, e)
glog.V(0).Infof("makeupDiff in CommitCompact volume %d failed %v", v.Id, e)
e = os.Remove(v.FileName() + ".cpd")
if e != nil {
return e