Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle namespace not found in replication #3557

Merged
merged 4 commits into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions client/clientBean.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ func (h *clientBeanImpl) GetRemoteAdminClient(cluster string) (adminservice.Admi
if !ok {
clusterInfo, clusterFound := h.clusterMetadata.GetAllClusterInfo()[cluster]
if !clusterFound {
return nil, &serviceerror.Unavailable{
return nil, &serviceerror.NotFound{
Message: fmt.Sprintf(
"Unknown cluster name: %v with given cluster information map: %v.",
cluster,
Expand Down Expand Up @@ -233,7 +233,7 @@ func (h *clientBeanImpl) GetRemoteFrontendClient(cluster string) (workflowservic
if !ok {
clusterInfo, clusterFound := h.clusterMetadata.GetAllClusterInfo()[cluster]
if !clusterFound {
return nil, &serviceerror.Unavailable{
return nil, &serviceerror.NotFound{
Message: fmt.Sprintf(
"Unknown cluster name: %v with given cluster information map: %v.",
cluster,
Expand Down
4 changes: 4 additions & 0 deletions service/history/replication/task_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ func (e *taskExecutorImpl) filterTask(

namespaceEntry, err := e.namespaceRegistry.GetNamespaceByID(namespaceID)
if err != nil {
if _, ok := err.(*serviceerror.NamespaceNotFound); ok {
// Drop the task
return false, nil
}
return false, err
}

Expand Down
11 changes: 11 additions & 0 deletions service/history/replication/task_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
commonpb "go.temporal.io/api/common/v1"
"go.temporal.io/api/serviceerror"

enumsspb "go.temporal.io/server/api/enums/v1"
historyspb "go.temporal.io/server/api/history/v1"
Expand Down Expand Up @@ -181,6 +182,16 @@ func (s *taskExecutorSuite) TestFilterTask_EnforceApply() {
s.True(ok)
}

func (s *taskExecutorSuite) TestFilterTask_NamespaceNotFound() {
namespaceID := namespace.ID(uuid.New())
s.mockNamespaceCache.EXPECT().
GetNamespaceByID(namespaceID).
Return(nil, &serviceerror.NamespaceNotFound{})
ok, err := s.replicationTaskExecutor.filterTask(namespaceID, false)
s.NoError(err)
s.False(ok)
}

func (s *taskExecutorSuite) TestProcessTaskOnce_SyncActivityReplicationTask() {
namespaceID := namespace.ID(uuid.New())
workflowID := uuid.New()
Expand Down