From 0709c04af34f6766e52b79463003ea8408060787 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Thu, 3 Dec 2026 16:36:43 -0800 Subject: [PATCH] volume(rs): report a volume a collection delete could not destroy The collection delete logged a refused destroy, kept the volume mounted and still answered success, so the caller never retried. Return the first error after the loop, as the Go store does, while the other volumes of the collection are still deleted. Co-Authored-By: Claude Opus 5.5 --- seaweed-volume/src/storage/disk_location.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/seaweed-volume/src/storage/disk_location.rs b/seaweed-volume/src/storage/disk_location.rs index c879d68cfc..5e42b23e6a 100644 --- a/seaweed-volume/src/storage/disk_location.rs +++ b/seaweed-volume/src/storage/disk_location.rs @@ -782,6 +782,7 @@ impl DiskLocation { /// Delete all volumes in a collection. pub fn delete_collection(&mut self, collection: &str) -> Result<(), VolumeError> { + let mut first_error = None; let vids: Vec = self .volumes .iter() @@ -793,6 +794,7 @@ impl DiskLocation { if let Some(v) = self.volumes.remove(&vid) { if let Err(e) = v.destroy(false, false, false) { warn!(volume_id = vid.0, error = %e, "delete collection: failed to destroy volume"); + first_error.get_or_insert(e); self.volumes.insert(vid, v); } else { crate::metrics::VOLUME_GAUGE @@ -819,7 +821,7 @@ impl DiskLocation { ec_vol.destroy(); } } - Ok(()) + first_error.map_or(Ok(()), Err) } // ---- Metrics ----