From a77d7ed381ba3a782a4984bbc3085e5eac412a41 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 17 Mar 2026 16:15:42 -0700 Subject: [PATCH] Match Go check_all_ec_shards_deleted: use MAX_SHARD_COUNT instead of hardcoded 14 Go's TotalShardsCount is DataShardsCount + ParityShardsCount = 14 by default, but custom EC configs via .vif can have more shards (up to MaxShardCount = 32). Using MAX_SHARD_COUNT ensures all shard files are checked regardless of EC configuration. --- seaweed-volume/src/storage/store.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/seaweed-volume/src/storage/store.rs b/seaweed-volume/src/storage/store.rs index 7bb3d6890..c722e8ac2 100644 --- a/seaweed-volume/src/storage/store.rs +++ b/seaweed-volume/src/storage/store.rs @@ -10,7 +10,7 @@ use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; use crate::config::MinFreeSpace; use crate::pb::master_pb; use crate::storage::disk_location::DiskLocation; -use crate::storage::erasure_coding::ec_shard::EcVolumeShard; +use crate::storage::erasure_coding::ec_shard::{EcVolumeShard, MAX_SHARD_COUNT}; use crate::storage::erasure_coding::ec_volume::EcVolume; use crate::storage::needle::needle::Needle; use crate::storage::needle_map::NeedleMapKind; @@ -697,9 +697,10 @@ impl Store { } /// Check if all EC shard files have been deleted for a volume. + /// Uses MAX_SHARD_COUNT to support non-standard EC configurations. fn check_all_ec_shards_deleted(&self, vid: VolumeId, collection: &str) -> bool { for loc in &self.locations { - for shard_id in 0..14u8 { + for shard_id in 0..MAX_SHARD_COUNT as u8 { let shard = EcVolumeShard::new(&loc.directory, collection, vid, shard_id); if std::path::Path::new(&shard.file_name()).exists() { return false;