diff options
| author | Chris Lu <chris.lu@gmail.com> | 2019-10-24 10:16:01 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2019-10-24 10:16:01 -0700 |
| commit | 9573c0f4b36a6cea0b1e924fcffe130ec734825d (patch) | |
| tree | 0cc09bfd7ee7db0045994a6468a9110b04f8615f /weed/command/filer_copy.go | |
| parent | 1b71608b3cfbaea884c4e7e60ac32de337374d25 (diff) | |
| download | seaweedfs-9573c0f4b36a6cea0b1e924fcffe130ec734825d.tar.xz seaweedfs-9573c0f4b36a6cea0b1e924fcffe130ec734825d.zip | |
filer: filer.copy cleanup in case of failed uploads
Diffstat (limited to 'weed/command/filer_copy.go')
| -rw-r--r-- | weed/command/filer_copy.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go index 1dd831cb6..cc73549b4 100644 --- a/weed/command/filer_copy.go +++ b/weed/command/filer_copy.go @@ -400,15 +400,21 @@ func (worker *FileCopyWorker) uploadFileInChunks(ctx context.Context, task FileC wg.Wait() close(chunksChan) - if uploadError != nil { - return uploadError - } var chunks []*filer_pb.FileChunk for chunk := range chunksChan { chunks = append(chunks, chunk) } + if uploadError != nil { + var fileIds []string + for _, chunk := range chunks { + fileIds = append(fileIds, chunk.FileId) + } + operation.DeleteFiles(worker.options.masterClient.GetMaster(), worker.options.grpcDialOption, fileIds) + return uploadError + } + if err := withFilerClient(ctx, worker.filerGrpcAddress, worker.options.grpcDialOption, func(client filer_pb.SeaweedFilerClient) error { request := &filer_pb.CreateEntryRequest{ Directory: task.destinationUrlPath, |
