copy ec shards to disks already having ec volumes

fix https://github.com/seaweedfs/seaweedfs/issues/5615
This commit is contained in:
chrislu
2024-09-03 21:19:10 -07:00
parent 3ca4069d86
commit 8e4bffc66b
3 changed files with 12 additions and 5 deletions

View File

@@ -63,7 +63,9 @@ func (vs *VolumeServer) VolumeCopy(req *volume_server_pb.VolumeCopyRequest, stre
if req.DiskType != "" {
diskType = req.DiskType
}
location := vs.store.FindFreeLocation(types.ToDiskType(diskType))
location := vs.store.FindFreeLocation(func(location *storage.DiskLocation) bool {
return location.DiskType == types.ToDiskType(diskType)
})
if location == nil {
return fmt.Errorf("no space left for disk type %s", types.ToDiskType(diskType).ReadableString())
}

View File

@@ -143,7 +143,10 @@ func (vs *VolumeServer) VolumeEcShardsCopy(ctx context.Context, req *volume_serv
glog.V(0).Infof("VolumeEcShardsCopy: %v", req)
location := vs.store.FindFreeLocation(types.HardDriveType)
location := vs.store.FindFreeLocation(func(location *storage.DiskLocation) bool {
_, found := location.FindEcVolume(needle.VolumeId(req.VolumeId))
return found
})
if location == nil {
return nil, fmt.Errorf("no space left")
}