Konstantin Lebedev 4 days ago
committed by GitHub
parent
commit
2ab9d00157
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 11
      weed/storage/volume_vacuum.go

11
weed/storage/volume_vacuum.go

@ -161,13 +161,20 @@ func (v *Volume) CommitCompact() error {
} }
} }
var e error var e error
if e = os.Rename(v.FileName(".cpd"), v.FileName(".dat")); e != nil {
cpdFile := v.FileName(".cpd")
if _, err := os.Stat(cpdFile); err == nil {
if e = os.Rename(cpdFile, v.FileName(".dat")); e != nil {
return fmt.Errorf("rename %s: %v", v.FileName(".cpd"), e) return fmt.Errorf("rename %s: %v", v.FileName(".cpd"), e)
} }
if e = os.Rename(v.FileName(".cpx"), v.FileName(".idx")); e != nil {
}
cpxFile := v.FileName(".cpx")
if _, err := os.Stat(cpdFile); err == nil {
if e = os.Rename(cpxFile, v.FileName(".idx")); e != nil {
return fmt.Errorf("rename %s: %v", v.FileName(".cpx"), e) return fmt.Errorf("rename %s: %v", v.FileName(".cpx"), e)
} }
} }
}
//glog.V(3).Infof("Pretending to be vacuuming...") //glog.V(3).Infof("Pretending to be vacuuming...")
//time.Sleep(20 * time.Second) //time.Sleep(20 * time.Second)

Loading…
Cancel
Save