From 5c14da0f1efbd835e076433c0b7f1a80aebf61c2 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Fri, 23 Jul 2021 20:01:43 -0700 Subject: [PATCH] filer.copy: fail early if assign request failed fix https://github.com/chrislusf/seaweedfs/issues/2216 --- weed/command/filer_copy.go | 3 +++ weed/operation/assign_file_id.go | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go index 97f1517cd..722f64679 100644 --- a/weed/command/filer_copy.go +++ b/weed/command/filer_copy.go @@ -381,6 +381,9 @@ func (worker *FileCopyWorker) uploadFileAsOne(task FileCopyTask, f *os.File) err if assignResult.Error != "" { return fmt.Errorf("assign volume failure %v: %v", request, assignResult.Error) } + if assignResult.Url == "" { + return fmt.Errorf("assign volume failure %v: %v", request, assignResult) + } return nil }) }) diff --git a/weed/operation/assign_file_id.go b/weed/operation/assign_file_id.go index ffd3e4938..fabc820ff 100644 --- a/weed/operation/assign_file_id.go +++ b/weed/operation/assign_file_id.go @@ -73,6 +73,10 @@ func Assign(masterFn GetMasterFn, grpcDialOption grpc.DialOption, primaryRequest ret.Error = resp.Error ret.Auth = security.EncodedJwt(resp.Auth) + if resp.Error != "" { + return fmt.Errorf("assignRequest: %v", resp.Error) + } + return nil })