filer.copy: fail early if assign request failed

fix https://github.com/chrislusf/seaweedfs/issues/2216
This commit is contained in:
Chris Lu 2021-07-23 20:01:43 -07:00
parent 4cc2165061
commit 5c14da0f1e
2 changed files with 7 additions and 0 deletions

View file

@ -381,6 +381,9 @@ func (worker *FileCopyWorker) uploadFileAsOne(task FileCopyTask, f *os.File) err
if assignResult.Error != "" { if assignResult.Error != "" {
return fmt.Errorf("assign volume failure %v: %v", request, 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 return nil
}) })
}) })

View file

@ -73,6 +73,10 @@ func Assign(masterFn GetMasterFn, grpcDialOption grpc.DialOption, primaryRequest
ret.Error = resp.Error ret.Error = resp.Error
ret.Auth = security.EncodedJwt(resp.Auth) ret.Auth = security.EncodedJwt(resp.Auth)
if resp.Error != "" {
return fmt.Errorf("assignRequest: %v", resp.Error)
}
return nil return nil
}) })