From e37baf1839cf8516695b98ce7581facd4025e727 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 17 Mar 2026 22:43:13 -0700 Subject: [PATCH] Remove .vif file in EC volume destroy matching Go's Destroy() Go's EcVolume.Destroy() removes .ecx, .ecj, and .vif files. The Rust version only removed .ecx and .ecj, leaving orphaned .vif files on disk after EC volume destruction (e.g., after TTL expiry). --- .../src/storage/erasure_coding/ec_volume.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/seaweed-volume/src/storage/erasure_coding/ec_volume.rs b/seaweed-volume/src/storage/erasure_coding/ec_volume.rs index ff3973f20..24967c04a 100644 --- a/seaweed-volume/src/storage/erasure_coding/ec_volume.rs +++ b/seaweed-volume/src/storage/erasure_coding/ec_volume.rs @@ -768,7 +768,8 @@ impl EcVolume { } *shard = None; } - // Remove .ecx/.ecj from ecx_actual_dir (where they were found) + // Remove .ecx/.ecj/.vif from ecx_actual_dir (where they were found) + // Go's Destroy() removes .ecx, .ecj, and .vif files. let actual_base = crate::storage::volume::volume_file_name( &self.ecx_actual_dir, &self.collection, @@ -776,10 +777,17 @@ impl EcVolume { ); let _ = fs::remove_file(format!("{}.ecx", actual_base)); let _ = fs::remove_file(format!("{}.ecj", actual_base)); + let _ = fs::remove_file(format!("{}.vif", actual_base)); // Also try the configured idx dir and data dir in case files exist in either if self.ecx_actual_dir != self.dir_idx { let _ = fs::remove_file(self.ecx_file_name()); let _ = fs::remove_file(self.ecj_file_name()); + let idx_base = crate::storage::volume::volume_file_name( + &self.dir_idx, + &self.collection, + self.volume_id, + ); + let _ = fs::remove_file(format!("{}.vif", idx_base)); } if self.ecx_actual_dir != self.dir && self.dir_idx != self.dir { let data_base = crate::storage::volume::volume_file_name( @@ -789,6 +797,7 @@ impl EcVolume { ); let _ = fs::remove_file(format!("{}.ecx", data_base)); let _ = fs::remove_file(format!("{}.ecj", data_base)); + let _ = fs::remove_file(format!("{}.vif", data_base)); } self.ecx_file = None; self.ecj_file = None;