aboutsummaryrefslogtreecommitdiff
path: root/weed/server/volume_grpc_copy.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-02-09 11:38:42 -0800
committerChris Lu <chris.lu@gmail.com>2021-02-09 11:38:42 -0800
commit2bf5ea87d6788fc1b82d36ffaed42ce0345b955e (patch)
treeb83fdc9ec478696ff43ebdf05f556ac6cd4e5724 /weed/server/volume_grpc_copy.go
parentd221a937df38ff587e2392a313681b0a0f48138b (diff)
parent821c46edf10097200b986bd17dc01d3991cf57ff (diff)
downloadseaweedfs-2bf5ea87d6788fc1b82d36ffaed42ce0345b955e.tar.xz
seaweedfs-2bf5ea87d6788fc1b82d36ffaed42ce0345b955e.zip
Merge branch 'support_ssd_volume'
Diffstat (limited to 'weed/server/volume_grpc_copy.go')
-rw-r--r--weed/server/volume_grpc_copy.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/weed/server/volume_grpc_copy.go b/weed/server/volume_grpc_copy.go
index cfa3710a8..26c6b28e7 100644
--- a/weed/server/volume_grpc_copy.go
+++ b/weed/server/volume_grpc_copy.go
@@ -36,11 +36,6 @@ func (vs *VolumeServer) VolumeCopy(ctx context.Context, req *volume_server_pb.Vo
glog.V(0).Infof("deleted existing volume %d before copying.", req.VolumeId)
}
- location := vs.store.FindFreeLocation()
- if location == nil {
- return nil, fmt.Errorf("no space left")
- }
-
// the master will not start compaction for read-only volumes, so it is safe to just copy files directly
// copy .dat and .idx files
// read .idx .dat file size and timestamp
@@ -59,6 +54,11 @@ func (vs *VolumeServer) VolumeCopy(ctx context.Context, req *volume_server_pb.Vo
return fmt.Errorf("read volume file status failed, %v", err)
}
+ location := vs.store.FindFreeLocation(storage.DiskType(volFileInfoResp.DiskType))
+ if location == nil {
+ return fmt.Errorf("no space left")
+ }
+
dataBaseFileName = storage.VolumeFileName(location.Directory, volFileInfoResp.Collection, int(req.VolumeId))
indexBaseFileName = storage.VolumeFileName(location.IdxDirectory, volFileInfoResp.Collection, int(req.VolumeId))
@@ -206,6 +206,7 @@ func (vs *VolumeServer) ReadVolumeFileStatus(ctx context.Context, req *volume_se
resp.FileCount = v.FileCount()
resp.CompactionRevision = uint32(v.CompactionRevision)
resp.Collection = v.Collection
+ resp.DiskType = string(v.DiskType())
return resp, nil
}