mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-30 11:45:42 +00:00
volume: skip a shard-holding disk when staging a decoded volume (Go+Rust) (#10464)
volume: skip a shard-holding disk when staging a decoded volume ReceiveFile staged-new-volume mode picked any free disk of the target medium. Skip a disk that already holds the vid's EC shards (Go DiskLocation.FindEcVolume / Rust ec_volumes), so a decoded .dat never lands in the same directory as a shard. This lets a caller safely stage onto a shard host that has a spare disk, instead of requiring a host with no shard of the vid at all. Claude-Session: https://claude.ai/code/session_01Ks16jnt4S7gdDk8cheQ3xu
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user