Konstantin Lebedev
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
11 additions and
4 deletions
-
weed/storage/volume_vacuum.go
|
|
|
@ -161,11 +161,18 @@ func (v *Volume) CommitCompact() error { |
|
|
|
} |
|
|
|
} |
|
|
|
var e error |
|
|
|
if e = os.Rename(v.FileName(".cpd"), v.FileName(".dat")); e != nil { |
|
|
|
return fmt.Errorf("rename %s: %v", v.FileName(".cpd"), e) |
|
|
|
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) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if e = os.Rename(v.FileName(".cpx"), v.FileName(".idx")); e != nil { |
|
|
|
return fmt.Errorf("rename %s: %v", v.FileName(".cpx"), e) |
|
|
|
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) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|