diff --git a/seaweed-volume/src/storage/disk_location.rs b/seaweed-volume/src/storage/disk_location.rs index 3c706913b..e619bb82a 100644 --- a/seaweed-volume/src/storage/disk_location.rs +++ b/seaweed-volume/src/storage/disk_location.rs @@ -392,7 +392,7 @@ impl DiskLocation { let vids: Vec = self .volumes .iter() - .filter(|(_, v)| v.collection == collection) + .filter(|(_, v)| v.collection == collection && !v.is_compacting()) .map(|(vid, _)| *vid) .collect(); @@ -401,7 +401,9 @@ impl DiskLocation { crate::metrics::VOLUME_GAUGE .with_label_values(&[&v.collection, "volume"]) .dec(); - v.destroy(false)?; + if let Err(e) = v.destroy(false) { + warn!(volume_id = vid.0, error = %e, "delete collection: failed to destroy volume"); + } } } diff --git a/seaweed-volume/src/storage/volume.rs b/seaweed-volume/src/storage/volume.rs index aeaffdd7b..26bc69af9 100644 --- a/seaweed-volume/src/storage/volume.rs +++ b/seaweed-volume/src/storage/volume.rs @@ -556,6 +556,11 @@ impl Volume { Ok(v) } + /// Returns true if the volume is currently being compacted. + pub fn is_compacting(&self) -> bool { + self.is_compacting + } + // ---- File naming (matching Go) ---- /// Base filename: dir/collection_id or dir/id