SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
volume: skip a shard-holding disk when staging a decoded volume (Go+Rust) (#10464)
Chris Lu3b3e8af430b2
diff --git a/seaweed-volume/src/server/grpc_server.rs b/seaweed-volume/src/server/grpc_server.rsindex 95a26652ed..d6cf49f516 100644--- a/seaweed-volume/src/server/grpc_server.rs+++ b/seaweed-volume/src/server/grpc_server.rs@@ -1768,7 +1768,14 @@ impl VolumeServer for VolumeGrpcService {// .idx.copying/.vif.copying are not valid volume names,// so the scanner never half-loads a partial push.let want = DiskType::from_string(&info.disk_type);- match store.find_free_location_predicate(|l| l.disk_type == want) {+ let staged_vid = VolumeId(info.volume_id);+ // Skip a disk already holding this vid's EC shards, so the+ // decoded .dat never lands in the same directory as a shard —+ // lets the caller target a shard host that has a spare disk.+ match store.find_free_location_predicate(|l| {+ l.disk_type == want+ && !l.ec_volumes().any(|(v, _)| *v == staged_vid)+ }) {Some(i) => {let dir = store.locations[i].directory.clone();drop(store);diff --git a/weed/server/volume_grpc_copy.go b/weed/server/volume_grpc_copy.goindex 0d75348394..e925e20318 100644--- a/weed/server/volume_grpc_copy.go+++ b/weed/server/volume_grpc_copy.go@@ -700,7 +700,14 @@ func (vs *VolumeServer) ReceiveFile(stream volume_server_pb.VolumeServer_Receive// VolumeEcShardsToVolume(from_staged). .idx.copying/.vif.copying// are not valid volume names, so the scanner never half-loads.want := types.ToDiskType(fileInfo.DiskType)+ stagedVid := needle.VolumeId(fileInfo.VolumeId)loc := vs.store.FindFreeLocation(func(l *storage.DiskLocation) bool {+ // Skip a disk that already holds this vid's EC shards, so the+ // decoded .dat never lands in the same directory as a shard —+ // lets the caller target a shard host that has a spare disk.+ if _, holds := l.FindEcVolume(stagedVid); holds {+ return false+ }return l.DiskType == want})if loc == nil {