From bddbc7439f2762ca5a934b056779e9ba6ed42046 Mon Sep 17 00:00:00 2001 From: Yu Xia Date: Fri, 16 Jun 2023 11:57:16 -0700 Subject: [PATCH] Cluster not found (#4501) * Change cluster not found error to unavailable error --- client/clientBean.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/client/clientBean.go b/client/clientBean.go index 329d678402b..ccbf0719dd9 100644 --- a/client/clientBean.go +++ b/client/clientBean.go @@ -184,7 +184,11 @@ func (h *clientBeanImpl) GetRemoteAdminClient(cluster string) (adminservice.Admi clusterInfo, clusterFound := h.clusterMetadata.GetAllClusterInfo()[cluster] if !clusterFound { - return nil, &serviceerror.NotFound{ + // We intentionally return internal error here. + // This error could only happen with internal mis-configuration. + // This can happen when a namespace is config for multiple clusters. But those clusters are not connected. + // We also have logic in task processing to drop tasks when namespace cluster exclude a local cluster. + return nil, &serviceerror.Internal{ Message: fmt.Sprintf( "Unknown cluster name: %v with given cluster information map: %v.", cluster, @@ -229,7 +233,11 @@ func (h *clientBeanImpl) GetRemoteFrontendClient(clusterName string) (grpc.Clien clusterInfo, clusterFound := h.clusterMetadata.GetAllClusterInfo()[clusterName] if !clusterFound { - return nil, nil, &serviceerror.NotFound{ + // We intentionally return internal error here. + // This error could only happen with internal mis-configuration. + // This can happen when a namespace is config for multiple clusters. But those clusters are not connected. + // We also have logic in task processing to drop tasks when namespace cluster exclude a local cluster. + return nil, nil, &serviceerror.Internal{ Message: fmt.Sprintf( "Unknown clusterName name: %v with given clusterName information map: %v.", clusterName,