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
writel throttling moving volumes
Chris Lu8ffdd5dcdb2e
diff --git a/weed/server/volume_grpc_copy.go b/weed/server/volume_grpc_copy.goindex b71398e1fb..e3ade61a14 100644--- a/weed/server/volume_grpc_copy.go+++ b/weed/server/volume_grpc_copy.go@@ -12,6 +12,7 @@ import ("github.com/chrislusf/seaweedfs/weed/pb/volume_server_pb""github.com/chrislusf/seaweedfs/weed/storage""github.com/chrislusf/seaweedfs/weed/storage/needle"+ "github.com/chrislusf/seaweedfs/weed/util")// VolumeCopy copy the .idx .dat files, and mount the volume@@ -60,7 +61,7 @@ func (vs *VolumeServer) VolumeCopy(ctx context.Context, req *volume_server_pb.Vo}idxFileName = volumeFileName + ".idx"- err = writeToFile(copyFileClient, idxFileName)+ err = writeToFile(copyFileClient, idxFileName, util.NewWriteThrottler(vs.compactionBytePerSecond))if err != nil {return fmt.Errorf("failed to copy volume %d idx file: %v", req.VolumeId, err)}@@ -76,7 +77,7 @@ func (vs *VolumeServer) VolumeCopy(ctx context.Context, req *volume_server_pb.Vo}datFileName = volumeFileName + ".dat"- err = writeToFile(copyFileClient, datFileName)+ err = writeToFile(copyFileClient, datFileName, util.NewWriteThrottler(vs.compactionBytePerSecond))if err != nil {return fmt.Errorf("failed to copy volume %d dat file: %v", req.VolumeId, err)}@@ -133,7 +134,7 @@ func checkCopyFiles(originFileInf *volume_server_pb.ReadVolumeFileStatusResponsereturn nil}-func writeToFile(client volume_server_pb.VolumeServer_CopyFileClient, fileName string) error {+func writeToFile(client volume_server_pb.VolumeServer_CopyFileClient, fileName string, wt *util.WriteThrottler) error {glog.V(4).Infof("writing to %s", fileName)dst, err := os.OpenFile(fileName, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)if err != nil {@@ -150,6 +151,7 @@ func writeToFile(client volume_server_pb.VolumeServer_CopyFileClient, fileName sreturn fmt.Errorf("receiving %s: %v", fileName, receiveErr)}dst.Write(resp.FileContent)+ wt.MaybeSlowdown(int64(len(resp.FileContent)))}return nil}