Browse Source

Match Go delete_collection: skip volumes with compaction in progress

Go checks !v.isCompactionInProgress.Load() before destroying a volume
during collection deletion, skipping compacting volumes. Also changed
destroy errors to log instead of aborting the entire collection delete.
rust-volume-server
Chris Lu 3 days ago
parent
commit
513d123145
  1. 6
      seaweed-volume/src/storage/disk_location.rs
  2. 5
      seaweed-volume/src/storage/volume.rs

6
seaweed-volume/src/storage/disk_location.rs

@ -392,7 +392,7 @@ impl DiskLocation {
let vids: Vec<VolumeId> = 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");
}
}
}

5
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

Loading…
Cancel
Save