Browse Source

fix: clean up .rdb index files in Go volume operations

Add .rdb (redb index) cleanup to removeVolumeFiles and vacuum commit
in Go code, for compatibility with mixed Rust/Go volume server
deployments. Route .rdb through dirIdx in FileName() like .idx/.ldb.
rust-volume-server
Chris Lu 1 day ago
parent
commit
3d6a87143a
  1. 2
      weed/storage/volume.go
  2. 1
      weed/storage/volume_vacuum.go
  3. 2
      weed/storage/volume_write.go

2
weed/storage/volume.go

@ -94,7 +94,7 @@ func (v *Volume) IndexFileName() (fileName string) {
func (v *Volume) FileName(ext string) (fileName string) { func (v *Volume) FileName(ext string) (fileName string) {
switch ext { switch ext {
case ".idx", ".cpx", ".ldb", ".cpldb":
case ".idx", ".cpx", ".ldb", ".cpldb", ".rdb":
return VolumeFileName(v.dirIdx, v.Collection, int(v.Id)) + ext return VolumeFileName(v.dirIdx, v.Collection, int(v.Id)) + ext
} }
// .dat, .cpd, .vif // .dat, .cpd, .vif

1
weed/storage/volume_vacuum.go

@ -199,6 +199,7 @@ func (v *Volume) CommitCompact() error {
//time.Sleep(20 * time.Second) //time.Sleep(20 * time.Second)
os.RemoveAll(v.FileName(".ldb")) os.RemoveAll(v.FileName(".ldb"))
os.Remove(v.FileName(".rdb"))
glog.V(3).Infof("Loading volume %d commit file...", v.Id) glog.V(3).Infof("Loading volume %d commit file...", v.Id)
if e = v.load(true, false, v.needleMapKind, 0, v.Version()); e != nil { if e = v.load(true, false, v.needleMapKind, 0, v.Version()); e != nil {

2
weed/storage/volume_write.go

@ -99,6 +99,8 @@ func removeVolumeFiles(filename string) {
os.Remove(filename + ".cpx") os.Remove(filename + ".cpx")
// level db index file // level db index file
os.RemoveAll(filename + ".ldb") os.RemoveAll(filename + ".ldb")
// redb index file (Rust volume server)
os.Remove(filename + ".rdb")
// marker for damaged or incomplete volume // marker for damaged or incomplete volume
os.Remove(filename + ".note") os.Remove(filename + ".note")
} }

Loading…
Cancel
Save