diff --git a/common/domain/errors.go b/common/domain/errors.go index a732e8c3846..4538fa65d78 100644 --- a/common/domain/errors.go +++ b/common/domain/errors.go @@ -34,7 +34,7 @@ var ( errInvalidGracefulFailover = &types.BadRequestError{Message: "Cannot start graceful failover without updating active cluster or in local domain."} errActiveClusterNameRequired = &types.BadRequestError{Message: "ActiveClusterName is required for all global domains."} errLocalDomainsCannotFailover = &types.BadRequestError{Message: "Local domains cannot perform failovers or change replication configuration"} - - errInvalidRetentionPeriod = &types.BadRequestError{Message: "A valid retention period is not set on request."} - errInvalidArchivalConfig = &types.BadRequestError{Message: "Invalid to enable archival without specifying a uri."} + errDomainDeprecated = &types.BadRequestError{Message: "Domain is deprecated."} + errInvalidRetentionPeriod = &types.BadRequestError{Message: "A valid retention period is not set on request."} + errInvalidArchivalConfig = &types.BadRequestError{Message: "Invalid to enable archival without specifying a uri."} ) diff --git a/common/domain/handler.go b/common/domain/handler.go index e0cf5473e15..a05bc9bc345 100644 --- a/common/domain/handler.go +++ b/common/domain/handler.go @@ -426,6 +426,10 @@ func (d *handlerImpl) UpdateDomain( if err != nil { return nil, err } + // Check if domain is deprecated + if currentDomainState.Info != nil && currentDomainState.Info.Status == persistence.DomainStatusDeprecated { + return nil, errDomainDeprecated + } // todo (david.porter) remove this and push the deepcopy into each of the branches getResponse := currentDomainState.DeepCopy() diff --git a/common/domain/handler_test.go b/common/domain/handler_test.go index f309cdf4dfa..75888c19228 100644 --- a/common/domain/handler_test.go +++ b/common/domain/handler_test.go @@ -2851,6 +2851,43 @@ func TestHandler_UpdateDomain(t *testing.T) { }, err: errors.New("handle-transmission-task-error"), }, + { + name: "Error case - update deprecated domain should return errDomainDeprecated", + setupMock: func(domainManager *persistence.MockDomainManager, updateRequest *types.UpdateDomainRequest, archivalMetadata *archiver.MockArchivalMetadata, timeSource clock.MockedTimeSource, _ *MockReplicator) { + domainResponse := &persistence.GetDomainResponse{ + ReplicationConfig: &persistence.DomainReplicationConfig{ + ActiveClusterName: cluster.TestCurrentClusterName, + Clusters: []*persistence.ClusterReplicationConfig{ + {ClusterName: cluster.TestCurrentClusterName}, {ClusterName: cluster.TestAlternativeClusterName}}, + }, + Config: &persistence.DomainConfig{ + Retention: 1, + EmitMetric: true, + HistoryArchivalStatus: types.ArchivalStatusDisabled, + VisibilityArchivalStatus: types.ArchivalStatusDisabled, + BadBinaries: types.BadBinaries{Binaries: map[string]*types.BadBinaryInfo{}}, + IsolationGroups: types.IsolationGroupConfiguration{}, + AsyncWorkflowConfig: types.AsyncWorkflowConfiguration{Enabled: true}, + }, + Info: &persistence.DomainInfo{ + Name: constants.TestDomainName, + ID: constants.TestDomainID, + Status: persistence.DomainStatusDeprecated, + }, + IsGlobalDomain: true, + LastUpdatedTime: timeSource.Now().UnixNano(), + FailoverVersion: cluster.TestCurrentClusterInitialFailoverVersion, + } + domainManager.EXPECT().GetMetadata(ctx).Return(&persistence.GetMetadataResponse{}, nil).Times(1) + domainManager.EXPECT().GetDomain(ctx, &persistence.GetDomainRequest{Name: updateRequest.GetName()}). + Return(domainResponse, nil).Times(1) + }, + request: &types.UpdateDomainRequest{ + Name: constants.TestDomainName, + ActiveClusterName: common.Ptr(cluster.TestAlternativeClusterName), + }, + err: errDomainDeprecated, + }, } for _, tc := range testCases { diff --git a/idls b/idls index 7b9d8a31de8..63b7e01d096 160000 --- a/idls +++ b/idls @@ -1 +1 @@ -Subproject commit 7b9d8a31de8c2af607176c2494b1ebbe5250b312 +Subproject commit 63b7e01d0963afc7ade25fe6122c33853b2af282