Browse Source

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

Add .rdb to remove_volume_files and commit_compact cleanup lists,
matching the Go-side changes for cross-compatible deployments.
rust-volume-server
Chris Lu 22 hours ago
parent
commit
501c344bf9
  1. 7
      seaweed-volume/src/storage/volume.rs

7
seaweed-volume/src/storage/volume.rs

@ -1827,9 +1827,11 @@ impl Volume {
fs::rename(&cpd_path, &dat_path)?; fs::rename(&cpd_path, &dat_path)?;
fs::rename(&cpx_path, &idx_path)?; fs::rename(&cpx_path, &idx_path)?;
// Remove any leveldb files
// Remove any leveldb/redb index files (rebuilt from .idx on reload)
let ldb_path = self.file_name(".ldb"); let ldb_path = self.file_name(".ldb");
let _ = fs::remove_dir_all(&ldb_path); let _ = fs::remove_dir_all(&ldb_path);
let rdb_path = self.file_name(".rdb");
let _ = fs::remove_file(&rdb_path);
// Reload // Reload
self.load(true, false, 0, self.version())?; self.load(true, false, 0, self.version())?;
@ -2069,9 +2071,10 @@ fn get_append_at_ns(last: u64) -> u64 {
/// Remove all files associated with a volume. /// Remove all files associated with a volume.
pub(crate) fn remove_volume_files(base: &str) { pub(crate) fn remove_volume_files(base: &str) {
for ext in &[".dat", ".idx", ".vif", ".sdx", ".cpd", ".cpx", ".note"] {
for ext in &[".dat", ".idx", ".vif", ".sdx", ".cpd", ".cpx", ".note", ".rdb"] {
let _ = fs::remove_file(format!("{}{}", base, ext)); let _ = fs::remove_file(format!("{}{}", base, ext));
} }
// leveldb uses a directory
let _ = fs::remove_dir_all(format!("{}.ldb", base)); let _ = fs::remove_dir_all(format!("{}.ldb", base));
} }

Loading…
Cancel
Save