|
|
@ -344,9 +344,9 @@ func (worker *FileCopyWorker) uploadFileAsOne(task FileCopyTask, f *os.File) err |
|
|
|
return err |
|
|
|
} |
|
|
|
|
|
|
|
err = util.Retry("upload", func() error { |
|
|
|
// assign a volume
|
|
|
|
err = util.Retry("assignVolume", func() error { |
|
|
|
return pb.WithGrpcFilerClient(worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
|
assignErr := pb.WithGrpcFilerClient(worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
|
|
|
|
|
request := &filer_pb.AssignVolumeRequest{ |
|
|
|
Count: 1, |
|
|
@ -369,11 +369,11 @@ func (worker *FileCopyWorker) uploadFileAsOne(task FileCopyTask, f *os.File) err |
|
|
|
} |
|
|
|
return nil |
|
|
|
}) |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("Failed to assign from %v: %v\n", worker.options.masters, err) |
|
|
|
if assignErr != nil { |
|
|
|
return assignErr |
|
|
|
} |
|
|
|
|
|
|
|
// uplaod data
|
|
|
|
targetUrl := "http://" + assignResult.Location.Url + "/" + assignResult.FileId |
|
|
|
uploadOption := &operation.UploadOption{ |
|
|
|
UploadUrl: targetUrl, |
|
|
@ -395,9 +395,15 @@ func (worker *FileCopyWorker) uploadFileAsOne(task FileCopyTask, f *os.File) err |
|
|
|
fmt.Printf("uploaded %s to %s\n", fileName, targetUrl) |
|
|
|
} |
|
|
|
|
|
|
|
fmt.Printf("copied %s => http://%s%s%s\n", f.Name(), worker.filerAddress.ToHttpAddress(), task.destinationUrlPath, fileName) |
|
|
|
chunks = append(chunks, uploadResult.ToPbFileChunk(assignResult.FileId, 0)) |
|
|
|
|
|
|
|
fmt.Printf("copied %s => http://%s%s%s\n", f.Name(), worker.filerAddress.ToHttpAddress(), task.destinationUrlPath, fileName) |
|
|
|
return nil |
|
|
|
}) |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("upload %v: %v\n", fileName, err) |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if err := pb.WithGrpcFilerClient(worker.filerAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
|