From c6ce73249cecde91b18598433153a9976a341d05 Mon Sep 17 00:00:00 2001 From: Vytautas Date: Thu, 26 May 2022 11:42:41 +0300 Subject: [PATCH] Removed global domain enabled config (#4845) --- cmd/server/cadence/server.go | 2 - common/cache/domainCache.go | 6 +- common/cache/domainCache_test.go | 12 - common/cluster/metadata.go | 19 - common/cluster/metadataTest.go | 21 +- common/cluster/metadata_mock.go | 14 - common/config/cluster.go | 6 - common/config/cluster_test.go | 1 - common/domain/handler.go | 13 +- .../handler_GlobalDomainDisabled_test.go | 529 ------------------ ..._test.go => handler_MasterCluster_test.go} | 38 +- ...st.go => handler_NotMasterCluster_test.go} | 2 +- common/domain/handler_test.go | 2 +- common/dynamicconfig/constants.go | 7 - common/mocks/ClusterMetadata.go | 14 - common/ndc/history_resender_test.go | 5 - .../persistence-tests/persistenceTestBase.go | 4 +- config/development.yaml | 1 - config/development_cross_region_cluster0.yaml | 1 - config/development_cross_region_cluster1.yaml | 1 - config/development_cross_region_cluster2.yaml | 1 - config/development_oauth.yaml | 1 - config/development_xdc_cluster0.yaml | 1 - config/development_xdc_cluster1.yaml | 1 - config/development_xdc_cluster2.yaml | 1 - docker/config_template.yaml | 1 - host/integrationbase.go | 2 +- host/ndc/integration_test.go | 2 +- host/testcluster.go | 9 +- .../ndc_integration_test_clusters.yaml | 5 +- .../testdata/xdc_integration_es_clusters.yaml | 4 +- .../xdc_integration_test_clusters.yaml | 2 - .../clusterRedirectionHandler_test.go | 1 - .../frontend/clusterRedirectionPolicy_test.go | 6 +- service/frontend/service.go | 11 +- service/frontend/workflowHandler_test.go | 7 +- service/history/constants/test_constants.go | 2 +- service/history/execution/cache_test.go | 2 - .../history/execution/state_builder_test.go | 1 - service/history/historyEngine.go | 25 +- service/history/historyEngine2_test.go | 1 - .../history/historyEngine3_eventsv2_test.go | 1 - service/history/historyEngine_test.go | 1 - .../history/ndc/activity_replicator_test.go | 1 - .../queue/cross_cluster_queue_processor.go | 6 +- .../history/queue/timer_queue_processor.go | 46 +- .../history/queue/transfer_queue_processor.go | 52 +- .../replication/task_ack_manager_test.go | 1 - ...cross_cluster_source_task_executor_test.go | 1 - ...cross_cluster_target_task_executor_test.go | 1 - .../history/task/cross_cluster_task_test.go | 1 - service/history/task/task_util.go | 4 - .../task/timer_active_task_executor_test.go | 1 - .../task/timer_standby_task_executor_test.go | 1 - .../transfer_active_task_executor_test.go | 1 - .../transfer_standby_task_executor_test.go | 1 - service/matching/taskListManager_test.go | 2 +- service/worker/esanalyzer/analyzer_test.go | 2 +- service/worker/service.go | 5 +- service/worker/shadower/workflow_test.go | 4 +- tools/cli/domainUtils.go | 12 +- 61 files changed, 121 insertions(+), 807 deletions(-) delete mode 100644 common/domain/handler_GlobalDomainDisabled_test.go rename common/domain/{handler_GlobalDomainEnabled_MasterCluster_test.go => handler_MasterCluster_test.go} (95%) rename common/domain/{handler_GlobalDomainEnabled_NotMasterCluster_test.go => handler_NotMasterCluster_test.go} (99%) diff --git a/cmd/server/cadence/server.go b/cmd/server/cadence/server.go index 36a9c4ec47a..b4b0aee64f6 100644 --- a/cmd/server/cadence/server.go +++ b/cmd/server/cadence/server.go @@ -190,8 +190,6 @@ func (s *server) startService() common.Daemon { params.MetricsClient = metrics.NewClient(params.MetricScope, service.GetMetricsServiceIdx(params.Name, params.Logger)) params.ClusterMetadata = cluster.NewMetadata( - params.Logger, - dc.GetBoolProperty(dynamicconfig.EnableGlobalDomain, clusterGroupMetadata.EnableGlobalDomain), clusterGroupMetadata.FailoverVersionIncrement, clusterGroupMetadata.PrimaryClusterName, clusterGroupMetadata.CurrentClusterName, diff --git a/common/cache/domainCache.go b/common/cache/domainCache.go index 81055f0869a..4072a55dbac 100644 --- a/common/cache/domainCache.go +++ b/common/cache/domainCache.go @@ -571,10 +571,8 @@ func (c *domainCache) updateIDToDomainCache( entry.Lock() defer entry.Unlock() - triggerCallback := c.clusterMetadata.IsGlobalDomainEnabled() && - // initialized will be true when the entry contains valid data - entry.initialized && - record.notificationVersion > entry.notificationVersion + // initialized will be true when the entry contains valid data + triggerCallback := entry.initialized && record.notificationVersion > entry.notificationVersion entry.info = record.info entry.config = record.config diff --git a/common/cache/domainCache_test.go b/common/cache/domainCache_test.go index 8542d21520f..f38f7c07bd5 100644 --- a/common/cache/domainCache_test.go +++ b/common/cache/domainCache_test.go @@ -34,7 +34,6 @@ import ( "github.com/uber/cadence/common" "github.com/uber/cadence/common/clock" "github.com/uber/cadence/common/cluster" - "github.com/uber/cadence/common/dynamicconfig" "github.com/uber/cadence/common/log" "github.com/uber/cadence/common/log/loggerimpl" "github.com/uber/cadence/common/metrics" @@ -154,7 +153,6 @@ func (s *domainCacheSuite) TestListDomain() { pageToken := []byte("some random page token") s.metadataMgr.On("GetMetadata", mock.Anything).Return(&persistence.GetMetadataResponse{NotificationVersion: domainNotificationVersion}, nil) - s.clusterMetadata.On("IsGlobalDomainEnabled").Return(true) s.metadataMgr.On("ListDomains", mock.Anything, &persistence.ListDomainsRequest{ PageSize: domainCacheRefreshPageSize, NextPageToken: nil, @@ -197,7 +195,6 @@ func (s *domainCacheSuite) TestListDomain() { } func (s *domainCacheSuite) TestGetDomain_NonLoaded_GetByName() { - s.clusterMetadata.On("IsGlobalDomainEnabled").Return(true) domainNotificationVersion := int64(999999) // make this notification version really large for test s.metadataMgr.On("GetMetadata", mock.Anything).Return(&persistence.GetMetadataResponse{NotificationVersion: domainNotificationVersion}, nil) domainRecord := &persistence.GetDomainResponse{ @@ -241,7 +238,6 @@ func (s *domainCacheSuite) TestGetDomain_NonLoaded_GetByName() { } func (s *domainCacheSuite) TestGetDomain_NonLoaded_GetByID() { - s.clusterMetadata.On("IsGlobalDomainEnabled").Return(true) domainNotificationVersion := int64(999999) // make this notification version really large for test s.metadataMgr.On("GetMetadata", mock.Anything).Return(&persistence.GetMetadataResponse{NotificationVersion: domainNotificationVersion}, nil) domainRecord := &persistence.GetDomainResponse{ @@ -280,7 +276,6 @@ func (s *domainCacheSuite) TestGetDomain_NonLoaded_GetByID() { } func (s *domainCacheSuite) TestGetActiveDomainEntry_LocalDomain() { - s.clusterMetadata.On("IsGlobalDomainEnabled").Return(true) domainNotificationVersion := int64(999999) // make this notification version really large for test s.metadataMgr.On("GetMetadata", mock.Anything).Return(&persistence.GetMetadataResponse{NotificationVersion: domainNotificationVersion}, nil) @@ -317,7 +312,6 @@ func (s *domainCacheSuite) TestGetActiveDomainEntry_LocalDomain() { } func (s *domainCacheSuite) TestGetActiveDomainEntry_ActiveGlobalDomain() { - s.clusterMetadata.On("IsGlobalDomainEnabled").Return(true) s.clusterMetadata.On("GetCurrentClusterName").Return(cluster.TestCurrentClusterName) domainNotificationVersion := int64(999999) // make this notification version really large for test s.metadataMgr.On("GetMetadata", mock.Anything).Return(&persistence.GetMetadataResponse{NotificationVersion: domainNotificationVersion}, nil) @@ -356,7 +350,6 @@ func (s *domainCacheSuite) TestGetActiveDomainEntry_ActiveGlobalDomain() { } func (s *domainCacheSuite) TestGetActiveDomainEntry_PassiveGlobalDomain() { - s.clusterMetadata.On("IsGlobalDomainEnabled").Return(true) s.clusterMetadata.On("GetCurrentClusterName").Return(cluster.TestCurrentClusterName) domainNotificationVersion := int64(999999) // make this notification version really large for test s.metadataMgr.On("GetMetadata", mock.Anything).Return(&persistence.GetMetadataResponse{NotificationVersion: domainNotificationVersion}, nil) @@ -441,7 +434,6 @@ func (s *domainCacheSuite) TestRegisterCallback_CatchUp() { domainNotificationVersion++ s.metadataMgr.On("GetMetadata", mock.Anything).Return(&persistence.GetMetadataResponse{NotificationVersion: domainNotificationVersion}, nil).Once() - s.clusterMetadata.On("IsGlobalDomainEnabled").Return(true) s.metadataMgr.On("ListDomains", mock.Anything, &persistence.ListDomainsRequest{ PageSize: domainCacheRefreshPageSize, NextPageToken: nil, @@ -519,7 +511,6 @@ func (s *domainCacheSuite) TestUpdateCache_TriggerCallBack() { domainNotificationVersion++ s.metadataMgr.On("GetMetadata", mock.Anything).Return(&persistence.GetMetadataResponse{NotificationVersion: domainNotificationVersion}, nil).Once() - s.clusterMetadata.On("IsGlobalDomainEnabled").Return(true) s.metadataMgr.On("ListDomains", mock.Anything, &persistence.ListDomainsRequest{ PageSize: domainCacheRefreshPageSize, NextPageToken: nil, @@ -605,7 +596,6 @@ func (s *domainCacheSuite) TestUpdateCache_TriggerCallBack() { } func (s *domainCacheSuite) TestGetTriggerListAndUpdateCache_ConcurrentAccess() { - s.clusterMetadata.On("IsGlobalDomainEnabled").Return(true) domainNotificationVersion := int64(999999) // make this notification version really large for test s.metadataMgr.On("GetMetadata", mock.Anything).Return(&persistence.GetMetadataResponse{NotificationVersion: domainNotificationVersion}, nil) id := uuid.New() @@ -764,8 +754,6 @@ func Test_IsSampledForLongerRetention(t *testing.T) { func Test_DomainCacheEntry_GetDomainNotActiveErr(t *testing.T) { clusterMetadata := cluster.NewMetadata( - loggerimpl.NewNopLogger(), - dynamicconfig.GetBoolPropertyFn(true), int64(10), cluster.TestCurrentClusterName, cluster.TestCurrentClusterName, diff --git a/common/cluster/metadata.go b/common/cluster/metadata.go index 105a0169028..e9151c0c58c 100644 --- a/common/cluster/metadata.go +++ b/common/cluster/metadata.go @@ -27,16 +27,11 @@ import ( "github.com/uber/cadence/common" "github.com/uber/cadence/common/config" - "github.com/uber/cadence/common/dynamicconfig" - "github.com/uber/cadence/common/log" ) type ( // Metadata provides information about clusters Metadata interface { - // IsGlobalDomainEnabled whether the global domain is enabled, - // this attr should be discarded when cross DC is made public - IsGlobalDomainEnabled() bool // IsPrimaryCluster whether current cluster is the primary cluster IsPrimaryCluster() bool // GetNextFailoverVersion return the next failover version for domain failover @@ -54,10 +49,6 @@ type ( } metadataImpl struct { - logger log.Logger - // EnableGlobalDomain whether the global domain is enabled, - // this attr should be discarded when cross DC is made public - enableGlobalDomain dynamicconfig.BoolPropertyFn // failoverVersionIncrement is the increment of each cluster's version when failover happen failoverVersionIncrement int64 // primaryClusterName is the name of the primary cluster, only the primary cluster can register / update domain @@ -74,8 +65,6 @@ type ( // NewMetadata create a new instance of Metadata func NewMetadata( - logger log.Logger, - enableGlobalDomain dynamicconfig.BoolPropertyFn, failoverVersionIncrement int64, primaryClusterName string, currentClusterName string, @@ -87,8 +76,6 @@ func NewMetadata( } return &metadataImpl{ - logger: logger, - enableGlobalDomain: enableGlobalDomain, failoverVersionIncrement: failoverVersionIncrement, primaryClusterName: primaryClusterName, currentClusterName: currentClusterName, @@ -97,12 +84,6 @@ func NewMetadata( } } -// IsGlobalDomainEnabled whether the global domain is enabled, -// this attr should be discarded when cross DC is made public -func (metadata *metadataImpl) IsGlobalDomainEnabled() bool { - return metadata.enableGlobalDomain() -} - // GetNextFailoverVersion return the next failover version based on input func (metadata *metadataImpl) GetNextFailoverVersion(cluster string, currentFailoverVersion int64) int64 { info, ok := metadata.clusterGroup[cluster] diff --git a/common/cluster/metadataTest.go b/common/cluster/metadataTest.go index 839bd0a5238..b6c3370c211 100644 --- a/common/cluster/metadataTest.go +++ b/common/cluster/metadataTest.go @@ -22,8 +22,6 @@ package cluster import ( "github.com/uber/cadence/common/config" - "github.com/uber/cadence/common/dynamicconfig" - "github.com/uber/cadence/common/log/loggerimpl" "github.com/uber/cadence/common/service" ) @@ -90,29 +88,16 @@ var ( ) // GetTestClusterMetadata return an cluster metadata instance, which is initialized -func GetTestClusterMetadata(enableGlobalDomain bool, isPrimaryCluster bool) Metadata { +func GetTestClusterMetadata(isPrimaryCluster bool) Metadata { primaryClusterName := TestCurrentClusterName if !isPrimaryCluster { primaryClusterName = TestAlternativeClusterName } - if enableGlobalDomain { - return NewMetadata( - loggerimpl.NewNopLogger(), - dynamicconfig.GetBoolPropertyFn(true), - TestFailoverVersionIncrement, - primaryClusterName, - TestCurrentClusterName, - TestAllClusterInfo, - ) - } - return NewMetadata( - loggerimpl.NewNopLogger(), - dynamicconfig.GetBoolPropertyFn(false), TestFailoverVersionIncrement, + primaryClusterName, TestCurrentClusterName, - TestCurrentClusterName, - TestSingleDCClusterInfo, + TestAllClusterInfo, ) } diff --git a/common/cluster/metadata_mock.go b/common/cluster/metadata_mock.go index 2e6466a678a..26e7be5cc13 100644 --- a/common/cluster/metadata_mock.go +++ b/common/cluster/metadata_mock.go @@ -57,20 +57,6 @@ func (m *MockMetadata) EXPECT() *MockMetadataMockRecorder { return m.recorder } -// IsGlobalDomainEnabled mocks base method -func (m *MockMetadata) IsGlobalDomainEnabled() bool { - m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "IsGlobalDomainEnabled") - ret0, _ := ret[0].(bool) - return ret0 -} - -// IsGlobalDomainEnabled indicates an expected call of IsGlobalDomainEnabled -func (mr *MockMetadataMockRecorder) IsGlobalDomainEnabled() *gomock.Call { - mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "IsGlobalDomainEnabled", reflect.TypeOf((*MockMetadata)(nil).IsGlobalDomainEnabled)) -} - // IsPrimaryCluster mocks base method func (m *MockMetadata) IsPrimaryCluster() bool { m.ctrl.T.Helper() diff --git a/common/config/cluster.go b/common/config/cluster.go index e828595cf72..a55788d8c6c 100644 --- a/common/config/cluster.go +++ b/common/config/cluster.go @@ -34,7 +34,6 @@ import ( type ( // ClusterGroupMetadata contains all the clusters participating in a replication group(aka XDC/GlobalDomain) ClusterGroupMetadata struct { - EnableGlobalDomain bool `yaml:"enableGlobalDomain"` // FailoverVersionIncrement is the increment of each cluster version when failover happens // It decides the maximum number clusters in this replication groups FailoverVersionIncrement int64 `yaml:"failoverVersionIncrement"` @@ -90,11 +89,6 @@ func (m *ClusterGroupMetadata) Validate() error { return errors.New("ClusterGroupMetadata cannot be empty") } - if !m.EnableGlobalDomain { - log.Println("[WARN] Local domain is now deprecated. Please update config to enable global domain(ClusterGroupMetadata->EnableGlobalDomain)." + - "Global domain of single cluster has zero overhead, but only advantages for future migration and fail over. Please check Cadence documentation for more details.") - } - var errs error if len(m.PrimaryClusterName) == 0 { diff --git a/common/config/cluster_test.go b/common/config/cluster_test.go index ef402e75e54..a630fb25022 100644 --- a/common/config/cluster_test.go +++ b/common/config/cluster_test.go @@ -176,7 +176,6 @@ func TestClusterGroupMetadataValidate(t *testing.T) { func validClusterGroupMetadata() *ClusterGroupMetadata { return &ClusterGroupMetadata{ - EnableGlobalDomain: true, FailoverVersionIncrement: 10, PrimaryClusterName: "active", CurrentClusterName: "standby", diff --git a/common/domain/handler.go b/common/domain/handler.go index c242792593c..c5c9eb74f0a 100644 --- a/common/domain/handler.go +++ b/common/domain/handler.go @@ -126,16 +126,9 @@ func (d *handlerImpl) RegisterDomain( registerRequest *types.RegisterDomainRequest, ) error { - if !d.clusterMetadata.IsGlobalDomainEnabled() { - if registerRequest.IsGlobalDomain { - return &types.BadRequestError{Message: "Cannot register global domain when not enabled. Please update config to enable global domain(recommended), " + - "or specify explicit parameter to create legacy local domain. Global domain of single cluster has zero overhead, but only advantages for future migration and fail over. Please check Cadence documentation for more details."} - } - } else { - // cluster global domain enabled - if !d.clusterMetadata.IsPrimaryCluster() && registerRequest.GetIsGlobalDomain() { - return errNotPrimaryCluster - } + // cluster global domain enabled + if !d.clusterMetadata.IsPrimaryCluster() && registerRequest.GetIsGlobalDomain() { + return errNotPrimaryCluster } // first check if the name is already registered as the local domain diff --git a/common/domain/handler_GlobalDomainDisabled_test.go b/common/domain/handler_GlobalDomainDisabled_test.go deleted file mode 100644 index e66d16e4f2e..00000000000 --- a/common/domain/handler_GlobalDomainDisabled_test.go +++ /dev/null @@ -1,529 +0,0 @@ -// Copyright (c) 2017 Uber Technologies, Inc. -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -package domain - -import ( - "context" - "log" - "os" - "testing" - "time" - - "github.com/pborman/uuid" - "github.com/stretchr/testify/suite" - - "github.com/uber/cadence/common" - "github.com/uber/cadence/common/archiver" - "github.com/uber/cadence/common/archiver/provider" - "github.com/uber/cadence/common/clock" - "github.com/uber/cadence/common/cluster" - "github.com/uber/cadence/common/config" - dc "github.com/uber/cadence/common/dynamicconfig" - "github.com/uber/cadence/common/log/loggerimpl" - "github.com/uber/cadence/common/mocks" - "github.com/uber/cadence/common/persistence" - "github.com/uber/cadence/common/persistence/nosql/nosqlplugin/cassandra/gocql/public" - persistencetests "github.com/uber/cadence/common/persistence/persistence-tests" - "github.com/uber/cadence/common/types" -) - -type ( - domainHandlerGlobalDomainDisabledSuite struct { - suite.Suite - persistencetests.TestBase - - minRetentionDays int - maxBadBinaryCount int - domainManager persistence.DomainManager - mockProducer *mocks.KafkaProducer - mockDomainReplicator Replicator - archivalMetadata archiver.ArchivalMetadata - mockArchiverProvider *provider.MockArchiverProvider - - handler *handlerImpl - } -) - -func TestDomainHandlerGlobalDomainDisabledSuite(t *testing.T) { - s := new(domainHandlerGlobalDomainDisabledSuite) - suite.Run(t, s) -} - -func (s *domainHandlerGlobalDomainDisabledSuite) SetupSuite() { - if testing.Verbose() { - log.SetOutput(os.Stdout) - } - - s.TestBase = public.NewTestBaseWithPublicCassandra(&persistencetests.TestBaseOptions{ - ClusterMetadata: cluster.GetTestClusterMetadata(false, false), - }) - s.TestBase.Setup() -} - -func (s *domainHandlerGlobalDomainDisabledSuite) TearDownSuite() { - s.TestBase.TearDownWorkflowStore() -} - -func (s *domainHandlerGlobalDomainDisabledSuite) SetupTest() { - logger := loggerimpl.NewNopLogger() - dcCollection := dc.NewCollection(dc.NewNopClient(), logger) - s.minRetentionDays = 1 - s.maxBadBinaryCount = 10 - s.domainManager = s.TestBase.DomainManager - s.mockProducer = &mocks.KafkaProducer{} - s.mockDomainReplicator = NewDomainReplicator(s.mockProducer, logger) - s.archivalMetadata = archiver.NewArchivalMetadata( - dcCollection, - "", - false, - "", - false, - &config.ArchivalDomainDefaults{}, - ) - domainConfig := Config{ - MinRetentionDays: dc.GetIntPropertyFn(s.minRetentionDays), - MaxBadBinaryCount: dc.GetIntPropertyFilteredByDomain(s.maxBadBinaryCount), - FailoverCoolDown: dc.GetDurationPropertyFnFilteredByDomain(0 * time.Second), - } - s.mockArchiverProvider = &provider.MockArchiverProvider{} - s.handler = NewHandler( - domainConfig, - logger, - s.domainManager, - s.ClusterMetadata, - s.mockDomainReplicator, - s.archivalMetadata, - s.mockArchiverProvider, - clock.NewRealTimeSource(), - ).(*handlerImpl) -} - -func (s *domainHandlerGlobalDomainDisabledSuite) TearDownTest() { - s.mockProducer.AssertExpectations(s.T()) - s.mockArchiverProvider.AssertExpectations(s.T()) -} - -func (s *domainHandlerGlobalDomainDisabledSuite) TestRegisterGetDomain_InvalidGlobalDomain() { - domainName := s.getRandomDomainName() - description := "some random description" - email := "some random email" - retention := int32(7) - emitMetric := true - activeClusterName := cluster.TestCurrentClusterName - clusters := []*types.ClusterReplicationConfiguration{ - { - ClusterName: activeClusterName, - }, - } - data := map[string]string{"some random key": "some random value"} - isGlobalDomain := true - - err := s.handler.RegisterDomain(context.Background(), &types.RegisterDomainRequest{ - Name: domainName, - Description: description, - OwnerEmail: email, - WorkflowExecutionRetentionPeriodInDays: retention, - EmitMetric: common.BoolPtr(emitMetric), - Clusters: clusters, - ActiveClusterName: activeClusterName, - Data: data, - IsGlobalDomain: isGlobalDomain, - }) - s.NotNil(err) - s.IsType(&types.BadRequestError{}, err) -} - -func (s *domainHandlerGlobalDomainDisabledSuite) TestRegisterGetDomain_InvalidCluster() { - domainName := s.getRandomDomainName() - description := "some random description" - email := "some random email" - retention := int32(7) - emitMetric := true - activeClusterName := cluster.TestAlternativeClusterName - clusters := []*types.ClusterReplicationConfiguration{ - { - ClusterName: activeClusterName, - }, - } - data := map[string]string{"some random key": "some random value"} - isGlobalDomain := false - - err := s.handler.RegisterDomain(context.Background(), &types.RegisterDomainRequest{ - Name: domainName, - Description: description, - OwnerEmail: email, - WorkflowExecutionRetentionPeriodInDays: retention, - EmitMetric: common.BoolPtr(emitMetric), - Clusters: clusters, - ActiveClusterName: activeClusterName, - Data: data, - IsGlobalDomain: isGlobalDomain, - }) - s.IsType(&types.BadRequestError{}, err) -} - -func (s *domainHandlerGlobalDomainDisabledSuite) TestRegisterGetDomain_AllDefault() { - domainName := s.getRandomDomainName() - var clusters []*types.ClusterReplicationConfiguration - for _, replicationConfig := range cluster.GetOrUseDefaultClusters(s.ClusterMetadata.GetCurrentClusterName(), nil) { - clusters = append(clusters, &types.ClusterReplicationConfiguration{ - ClusterName: replicationConfig.ClusterName, - }) - } - - retention := int32(1) - err := s.handler.RegisterDomain(context.Background(), &types.RegisterDomainRequest{ - Name: domainName, - WorkflowExecutionRetentionPeriodInDays: retention, - }) - s.Nil(err) - - resp, err := s.handler.DescribeDomain(context.Background(), &types.DescribeDomainRequest{ - Name: common.StringPtr(domainName), - }) - s.Nil(err) - - s.NotEmpty(resp.DomainInfo.GetUUID()) - resp.DomainInfo.UUID = "" - s.Equal(&types.DomainInfo{ - Name: domainName, - Status: types.DomainStatusRegistered.Ptr(), - Description: "", - OwnerEmail: "", - Data: map[string]string{}, - UUID: "", - }, resp.DomainInfo) - s.Equal(&types.DomainConfiguration{ - WorkflowExecutionRetentionPeriodInDays: retention, - EmitMetric: true, - HistoryArchivalStatus: types.ArchivalStatusDisabled.Ptr(), - HistoryArchivalURI: "", - VisibilityArchivalStatus: types.ArchivalStatusDisabled.Ptr(), - VisibilityArchivalURI: "", - BadBinaries: &types.BadBinaries{Binaries: map[string]*types.BadBinaryInfo{}}, - }, resp.Configuration) - s.Equal(&types.DomainReplicationConfiguration{ - ActiveClusterName: s.ClusterMetadata.GetCurrentClusterName(), - Clusters: clusters, - }, resp.ReplicationConfiguration) - s.Equal(common.EmptyVersion, resp.GetFailoverVersion()) - s.False(resp.GetIsGlobalDomain()) -} - -func (s *domainHandlerGlobalDomainDisabledSuite) TestRegisterGetDomain_NoDefault() { - domainName := s.getRandomDomainName() - description := "some random description" - email := "some random email" - retention := int32(7) - emitMetric := true - activeClusterName := cluster.TestCurrentClusterName - clusters := []*types.ClusterReplicationConfiguration{ - { - ClusterName: activeClusterName, - }, - } - data := map[string]string{"some random key": "some random value"} - isGlobalDomain := false - - var expectedClusters []*types.ClusterReplicationConfiguration - for _, replicationConfig := range cluster.GetOrUseDefaultClusters(s.ClusterMetadata.GetCurrentClusterName(), nil) { - expectedClusters = append(expectedClusters, &types.ClusterReplicationConfiguration{ - ClusterName: replicationConfig.ClusterName, - }) - } - - err := s.handler.RegisterDomain(context.Background(), &types.RegisterDomainRequest{ - Name: domainName, - Description: description, - OwnerEmail: email, - WorkflowExecutionRetentionPeriodInDays: retention, - EmitMetric: common.BoolPtr(emitMetric), - Clusters: clusters, - ActiveClusterName: activeClusterName, - Data: data, - IsGlobalDomain: isGlobalDomain, - }) - s.Nil(err) - - resp, err := s.handler.DescribeDomain(context.Background(), &types.DescribeDomainRequest{ - Name: common.StringPtr(domainName), - }) - s.Nil(err) - - s.NotEmpty(resp.DomainInfo.GetUUID()) - resp.DomainInfo.UUID = "" - s.Equal(&types.DomainInfo{ - Name: domainName, - Status: types.DomainStatusRegistered.Ptr(), - Description: description, - OwnerEmail: email, - Data: data, - UUID: "", - }, resp.DomainInfo) - s.Equal(&types.DomainConfiguration{ - WorkflowExecutionRetentionPeriodInDays: retention, - EmitMetric: emitMetric, - HistoryArchivalStatus: types.ArchivalStatusDisabled.Ptr(), - HistoryArchivalURI: "", - VisibilityArchivalStatus: types.ArchivalStatusDisabled.Ptr(), - VisibilityArchivalURI: "", - BadBinaries: &types.BadBinaries{Binaries: map[string]*types.BadBinaryInfo{}}, - }, resp.Configuration) - s.Equal(&types.DomainReplicationConfiguration{ - ActiveClusterName: s.ClusterMetadata.GetCurrentClusterName(), - Clusters: expectedClusters, - }, resp.ReplicationConfiguration) - s.Equal(common.EmptyVersion, resp.GetFailoverVersion()) - s.Equal(isGlobalDomain, resp.GetIsGlobalDomain()) -} - -func (s *domainHandlerGlobalDomainDisabledSuite) TestUpdateGetDomain_NoAttrSet() { - domainName := s.getRandomDomainName() - description := "some random description" - email := "some random email" - retention := int32(7) - emitMetric := true - data := map[string]string{"some random key": "some random value"} - var clusters []*types.ClusterReplicationConfiguration - for _, replicationConfig := range cluster.GetOrUseDefaultClusters(s.ClusterMetadata.GetCurrentClusterName(), nil) { - clusters = append(clusters, &types.ClusterReplicationConfiguration{ - ClusterName: replicationConfig.ClusterName, - }) - } - - err := s.handler.RegisterDomain(context.Background(), &types.RegisterDomainRequest{ - Name: domainName, - Description: description, - OwnerEmail: email, - WorkflowExecutionRetentionPeriodInDays: retention, - EmitMetric: common.BoolPtr(emitMetric), - Clusters: clusters, - ActiveClusterName: s.ClusterMetadata.GetCurrentClusterName(), - Data: data, - }) - s.Nil(err) - - fnTest := func(info *types.DomainInfo, config *types.DomainConfiguration, - replicationConfig *types.DomainReplicationConfiguration, isGlobalDomain bool, failoverVersion int64) { - s.NotEmpty(info.GetUUID()) - info.UUID = "" - s.Equal(&types.DomainInfo{ - Name: domainName, - Status: types.DomainStatusRegistered.Ptr(), - Description: description, - OwnerEmail: email, - Data: data, - UUID: "", - }, info) - s.Equal(&types.DomainConfiguration{ - WorkflowExecutionRetentionPeriodInDays: retention, - EmitMetric: emitMetric, - HistoryArchivalStatus: types.ArchivalStatusDisabled.Ptr(), - HistoryArchivalURI: "", - VisibilityArchivalStatus: types.ArchivalStatusDisabled.Ptr(), - VisibilityArchivalURI: "", - BadBinaries: &types.BadBinaries{Binaries: map[string]*types.BadBinaryInfo{}}, - }, config) - s.Equal(&types.DomainReplicationConfiguration{ - ActiveClusterName: s.ClusterMetadata.GetCurrentClusterName(), - Clusters: clusters, - }, replicationConfig) - s.Equal(common.EmptyVersion, failoverVersion) - s.False(isGlobalDomain) - } - - updateResp, err := s.handler.UpdateDomain(context.Background(), &types.UpdateDomainRequest{ - Name: domainName, - }) - s.Nil(err) - fnTest( - updateResp.DomainInfo, - updateResp.Configuration, - updateResp.ReplicationConfiguration, - updateResp.GetIsGlobalDomain(), - updateResp.GetFailoverVersion(), - ) - - getResp, err := s.handler.DescribeDomain(context.Background(), &types.DescribeDomainRequest{ - Name: common.StringPtr(domainName), - }) - s.Nil(err) - fnTest( - getResp.DomainInfo, - getResp.Configuration, - getResp.ReplicationConfiguration, - getResp.GetIsGlobalDomain(), - getResp.GetFailoverVersion(), - ) -} - -func (s *domainHandlerGlobalDomainDisabledSuite) TestUpdateGetDomain_AllAttrSet() { - domainName := s.getRandomDomainName() - err := s.handler.RegisterDomain(context.Background(), &types.RegisterDomainRequest{ - Name: domainName, - WorkflowExecutionRetentionPeriodInDays: 1, - }) - s.Nil(err) - - description := "some random description" - email := "some random email" - retention := int32(7) - emitMetric := true - activeClusterName := cluster.TestCurrentClusterName - clusters := []*types.ClusterReplicationConfiguration{ - { - ClusterName: activeClusterName, - }, - } - data := map[string]string{"some random key": "some random value"} - - var expectedClusters []*types.ClusterReplicationConfiguration - for _, replicationConfig := range cluster.GetOrUseDefaultClusters(s.ClusterMetadata.GetCurrentClusterName(), nil) { - expectedClusters = append(expectedClusters, &types.ClusterReplicationConfiguration{ - ClusterName: replicationConfig.ClusterName, - }) - } - - fnTest := func(info *types.DomainInfo, config *types.DomainConfiguration, - replicationConfig *types.DomainReplicationConfiguration, isGlobalDomain bool, failoverVersion int64) { - s.NotEmpty(info.GetUUID()) - info.UUID = "" - s.Equal(&types.DomainInfo{ - Name: domainName, - Status: types.DomainStatusRegistered.Ptr(), - Description: description, - OwnerEmail: email, - Data: data, - UUID: "", - }, info) - s.Equal(&types.DomainConfiguration{ - WorkflowExecutionRetentionPeriodInDays: retention, - EmitMetric: emitMetric, - HistoryArchivalStatus: types.ArchivalStatusDisabled.Ptr(), - HistoryArchivalURI: "", - VisibilityArchivalStatus: types.ArchivalStatusDisabled.Ptr(), - VisibilityArchivalURI: "", - BadBinaries: &types.BadBinaries{Binaries: map[string]*types.BadBinaryInfo{}}, - }, config) - s.Equal(&types.DomainReplicationConfiguration{ - ActiveClusterName: s.ClusterMetadata.GetCurrentClusterName(), - Clusters: expectedClusters, - }, replicationConfig) - s.Equal(common.EmptyVersion, failoverVersion) - s.False(isGlobalDomain) - } - - updateResp, err := s.handler.UpdateDomain(context.Background(), &types.UpdateDomainRequest{ - Name: domainName, - Description: common.StringPtr(description), - OwnerEmail: common.StringPtr(email), - Data: data, - WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention), - EmitMetric: common.BoolPtr(emitMetric), - HistoryArchivalStatus: types.ArchivalStatusDisabled.Ptr(), - HistoryArchivalURI: common.StringPtr(""), - VisibilityArchivalStatus: types.ArchivalStatusDisabled.Ptr(), - VisibilityArchivalURI: common.StringPtr(""), - BadBinaries: &types.BadBinaries{Binaries: map[string]*types.BadBinaryInfo{}}, - ActiveClusterName: common.StringPtr(activeClusterName), - Clusters: clusters, - }) - s.Nil(err) - fnTest(updateResp.DomainInfo, updateResp.Configuration, updateResp.ReplicationConfiguration, updateResp.GetIsGlobalDomain(), updateResp.GetFailoverVersion()) - - getResp, err := s.handler.DescribeDomain(context.Background(), &types.DescribeDomainRequest{ - Name: common.StringPtr(domainName), - }) - s.Nil(err) - fnTest( - getResp.DomainInfo, - getResp.Configuration, - getResp.ReplicationConfiguration, - getResp.GetIsGlobalDomain(), - getResp.GetFailoverVersion(), - ) -} - -func (s *domainHandlerGlobalDomainDisabledSuite) TestDeprecateGetDomain() { - // setup domain - domainName := s.getRandomDomainName() - domain := s.setupLocalDomain(domainName) - - // execute the function to be tested - err := s.handler.DeprecateDomain(context.Background(), &types.DeprecateDomainRequest{ - Name: domainName, - }) - s.Nil(err) - - // verify the execution result - expectedResp := domain - expectedResp.DomainInfo.Status = types.DomainStatusDeprecated.Ptr() - - getResp, err := s.handler.DescribeDomain(context.Background(), &types.DescribeDomainRequest{ - Name: common.StringPtr(domainName), - }) - s.Nil(err) - assertDomainEqual(s.Suite, getResp, expectedResp) -} - -func (s *domainHandlerGlobalDomainDisabledSuite) getRandomDomainName() string { - return "domain" + uuid.New() -} - -func (s *domainHandlerGlobalDomainDisabledSuite) setupLocalDomain(domainName string) *types.DescribeDomainResponse { - return setupLocalDomain(s.Suite, s.handler, s.ClusterMetadata, domainName) -} - -func setupLocalDomain(s suite.Suite, handler *handlerImpl, clusterMetadata cluster.Metadata, domainName string) *types.DescribeDomainResponse { - description := "some random description" - email := "some random email" - retention := int32(7) - emitMetric := true - data := map[string]string{"some random key": "some random value"} - var clusters []*types.ClusterReplicationConfiguration - for _, replicationConfig := range cluster.GetOrUseDefaultClusters(clusterMetadata.GetCurrentClusterName(), nil) { - clusters = append(clusters, &types.ClusterReplicationConfiguration{ - ClusterName: replicationConfig.ClusterName, - }) - } - err := handler.RegisterDomain(context.Background(), &types.RegisterDomainRequest{ - Name: domainName, - Description: description, - OwnerEmail: email, - WorkflowExecutionRetentionPeriodInDays: retention, - EmitMetric: common.BoolPtr(emitMetric), - Clusters: clusters, - ActiveClusterName: clusterMetadata.GetCurrentClusterName(), - Data: data, - }) - s.Nil(err) - getResp, err := handler.DescribeDomain(context.Background(), &types.DescribeDomainRequest{ - Name: common.StringPtr(domainName), - }) - s.Nil(err) - return getResp -} - -func assertDomainEqual(s suite.Suite, autual, expected *types.DescribeDomainResponse) { - s.NotEmpty(autual.DomainInfo.GetUUID()) - expected.DomainInfo.UUID = autual.DomainInfo.GetUUID() - s.Equal(expected, autual) -} diff --git a/common/domain/handler_GlobalDomainEnabled_MasterCluster_test.go b/common/domain/handler_MasterCluster_test.go similarity index 95% rename from common/domain/handler_GlobalDomainEnabled_MasterCluster_test.go rename to common/domain/handler_MasterCluster_test.go index 9a8824f8f7f..4816ec5c96e 100644 --- a/common/domain/handler_GlobalDomainEnabled_MasterCluster_test.go +++ b/common/domain/handler_MasterCluster_test.go @@ -74,7 +74,7 @@ func (s *domainHandlerGlobalDomainEnabledPrimaryClusterSuite) SetupSuite() { } s.TestBase = public.NewTestBaseWithPublicCassandra(&persistencetests.TestBaseOptions{ - ClusterMetadata: cluster.GetTestClusterMetadata(true, true), + ClusterMetadata: cluster.GetTestClusterMetadata(true), }) s.TestBase.Setup() } @@ -1023,3 +1023,39 @@ func setupGlobalDomain(s suite.Suite, handler *handlerImpl, clusterMetadata clus s.Nil(err) return getResp } + +func setupLocalDomain(s suite.Suite, handler *handlerImpl, clusterMetadata cluster.Metadata, domainName string) *types.DescribeDomainResponse { + description := "some random description" + email := "some random email" + retention := int32(7) + emitMetric := true + data := map[string]string{"some random key": "some random value"} + var clusters []*types.ClusterReplicationConfiguration + for _, replicationConfig := range cluster.GetOrUseDefaultClusters(clusterMetadata.GetCurrentClusterName(), nil) { + clusters = append(clusters, &types.ClusterReplicationConfiguration{ + ClusterName: replicationConfig.ClusterName, + }) + } + err := handler.RegisterDomain(context.Background(), &types.RegisterDomainRequest{ + Name: domainName, + Description: description, + OwnerEmail: email, + WorkflowExecutionRetentionPeriodInDays: retention, + EmitMetric: common.BoolPtr(emitMetric), + Clusters: clusters, + ActiveClusterName: clusterMetadata.GetCurrentClusterName(), + Data: data, + }) + s.Nil(err) + getResp, err := handler.DescribeDomain(context.Background(), &types.DescribeDomainRequest{ + Name: common.StringPtr(domainName), + }) + s.Nil(err) + return getResp +} + +func assertDomainEqual(s suite.Suite, autual, expected *types.DescribeDomainResponse) { + s.NotEmpty(autual.DomainInfo.GetUUID()) + expected.DomainInfo.UUID = autual.DomainInfo.GetUUID() + s.Equal(expected, autual) +} diff --git a/common/domain/handler_GlobalDomainEnabled_NotMasterCluster_test.go b/common/domain/handler_NotMasterCluster_test.go similarity index 99% rename from common/domain/handler_GlobalDomainEnabled_NotMasterCluster_test.go rename to common/domain/handler_NotMasterCluster_test.go index 6c40d86b895..772fc909faf 100644 --- a/common/domain/handler_GlobalDomainEnabled_NotMasterCluster_test.go +++ b/common/domain/handler_NotMasterCluster_test.go @@ -74,7 +74,7 @@ func (s *domainHandlerGlobalDomainEnabledNotPrimaryClusterSuite) SetupSuite() { } s.TestBase = public.NewTestBaseWithPublicCassandra(&persistencetests.TestBaseOptions{ - ClusterMetadata: cluster.GetTestClusterMetadata(true, false), + ClusterMetadata: cluster.GetTestClusterMetadata(false), }) s.TestBase.Setup() } diff --git a/common/domain/handler_test.go b/common/domain/handler_test.go index 265a750faed..f9d70ff0538 100644 --- a/common/domain/handler_test.go +++ b/common/domain/handler_test.go @@ -77,7 +77,7 @@ func (s *domainHandlerCommonSuite) SetupSuite() { } s.TestBase = public.NewTestBaseWithPublicCassandra(&persistencetests.TestBaseOptions{ - ClusterMetadata: cluster.GetTestClusterMetadata(true, true), + ClusterMetadata: cluster.GetTestClusterMetadata(true), }) s.TestBase.Setup() } diff --git a/common/dynamicconfig/constants.go b/common/dynamicconfig/constants.go index fa9842fd996..6d1cd4c16fb 100644 --- a/common/dynamicconfig/constants.go +++ b/common/dynamicconfig/constants.go @@ -67,12 +67,6 @@ const ( // key for common & admin - // EnableGlobalDomain is key for enable global domain - // KeyName: system.enableGlobalDomain - // Value type: Bool - // Default value: false - // Allowed filters: N/A - EnableGlobalDomain // EnableVisibilitySampling is key for enable visibility sampling for basic(DB based) visibility // KeyName: system.enableVisibilitySampling // Value type: Bool @@ -2193,7 +2187,6 @@ var Keys = map[Key]string{ TestGetBoolPropertyFilteredByTaskListInfoKey: "testGetBoolPropertyFilteredByTaskListInfoKey", // system settings - EnableGlobalDomain: "system.enableGlobalDomain", EnableVisibilitySampling: "system.enableVisibilitySampling", EnableReadFromClosedExecutionV2: "system.enableReadFromClosedExecutionV2", AdvancedVisibilityWritingMode: "system.advancedVisibilityWritingMode", diff --git a/common/mocks/ClusterMetadata.go b/common/mocks/ClusterMetadata.go index ad6a8edd017..866366690b1 100644 --- a/common/mocks/ClusterMetadata.go +++ b/common/mocks/ClusterMetadata.go @@ -131,20 +131,6 @@ func (_m *ClusterMetadata) IsVersionFromSameCluster(_a0 int64, _a1 int64) bool { return r0 } -// IsGlobalDomainEnabled provides a mock function with given fields: -func (_m *ClusterMetadata) IsGlobalDomainEnabled() bool { - ret := _m.Called() - - var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - // IsPrimaryCluster provides a mock function with given fields: func (_m *ClusterMetadata) IsPrimaryCluster() bool { ret := _m.Called() diff --git a/common/ndc/history_resender_test.go b/common/ndc/history_resender_test.go index 8b55cda1acc..cd63cadfd9d 100644 --- a/common/ndc/history_resender_test.go +++ b/common/ndc/history_resender_test.go @@ -37,7 +37,6 @@ import ( "github.com/uber/cadence/common/cluster" "github.com/uber/cadence/common/log" "github.com/uber/cadence/common/log/loggerimpl" - "github.com/uber/cadence/common/mocks" "github.com/uber/cadence/common/persistence" "github.com/uber/cadence/common/reconciliation/entity" "github.com/uber/cadence/common/reconciliation/invariant" @@ -57,8 +56,6 @@ type ( domainID string domainName string - mockClusterMetadata *mocks.ClusterMetadata - serializer persistence.PayloadSerializer logger log.Logger @@ -80,8 +77,6 @@ func (s *historyResenderSuite) SetupTest() { s.mockDomainCache = cache.NewMockDomainCache(s.controller) s.logger = loggerimpl.NewLoggerForTest(s.Suite) - s.mockClusterMetadata = &mocks.ClusterMetadata{} - s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(true) s.domainID = uuid.New() s.domainName = "some random domain name" diff --git a/common/persistence/persistence-tests/persistenceTestBase.go b/common/persistence/persistence-tests/persistenceTestBase.go index 19d43132f79..1237038b9da 100644 --- a/common/persistence/persistence-tests/persistenceTestBase.go +++ b/common/persistence/persistence-tests/persistenceTestBase.go @@ -130,7 +130,7 @@ func NewTestBaseWithNoSQL(options *TestBaseOptions) TestBase { testCluster := nosql.NewTestCluster(options.DBPluginName, options.DBName, options.DBUsername, options.DBPassword, options.DBHost, options.DBPort, options.ProtoVersion, "") metadata := options.ClusterMetadata if metadata == nil { - metadata = cluster.GetTestClusterMetadata(false, false) + metadata = cluster.GetTestClusterMetadata(false) } params := TestBaseParams{ DefaultTestCluster: testCluster, @@ -148,7 +148,7 @@ func NewTestBaseWithSQL(options *TestBaseOptions) TestBase { testCluster := sql.NewTestCluster(options.DBPluginName, options.DBName, options.DBUsername, options.DBPassword, options.DBHost, options.DBPort, options.SchemaDir) metadata := options.ClusterMetadata if metadata == nil { - metadata = cluster.GetTestClusterMetadata(false, false) + metadata = cluster.GetTestClusterMetadata(false) } params := TestBaseParams{ DefaultTestCluster: testCluster, diff --git a/config/development.yaml b/config/development.yaml index 8a1fe2181fe..8f010b9e078 100644 --- a/config/development.yaml +++ b/config/development.yaml @@ -72,7 +72,6 @@ services: port: 7940 clusterGroupMetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "cluster0" currentClusterName: "cluster0" diff --git a/config/development_cross_region_cluster0.yaml b/config/development_cross_region_cluster0.yaml index b13813c7686..d6b316af82e 100644 --- a/config/development_cross_region_cluster0.yaml +++ b/config/development_cross_region_cluster0.yaml @@ -69,7 +69,6 @@ services: port: 7941 clusterGroupMetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "cluster0" currentClusterName: "cluster0" diff --git a/config/development_cross_region_cluster1.yaml b/config/development_cross_region_cluster1.yaml index 5404252c9d5..4e8694620e3 100644 --- a/config/development_cross_region_cluster1.yaml +++ b/config/development_cross_region_cluster1.yaml @@ -69,7 +69,6 @@ services: port: 8941 clusterGroupMetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "cluster0" currentClusterName: "cluster1" diff --git a/config/development_cross_region_cluster2.yaml b/config/development_cross_region_cluster2.yaml index 8958dc3d974..b4903a73df5 100644 --- a/config/development_cross_region_cluster2.yaml +++ b/config/development_cross_region_cluster2.yaml @@ -69,7 +69,6 @@ services: port: 9941 clusterGroupMetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "cluster0" currentClusterName: "cluster2" diff --git a/config/development_oauth.yaml b/config/development_oauth.yaml index a4fb30a2106..b413e16d459 100644 --- a/config/development_oauth.yaml +++ b/config/development_oauth.yaml @@ -41,7 +41,6 @@ authorization: publicKey: "config/credentials/keytest.pub" clusterGroupMetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 masterClusterName: "cluster0" currentClusterName: "cluster0" diff --git a/config/development_xdc_cluster0.yaml b/config/development_xdc_cluster0.yaml index 9d7cbe655e3..2f58da4c756 100644 --- a/config/development_xdc_cluster0.yaml +++ b/config/development_xdc_cluster0.yaml @@ -69,7 +69,6 @@ services: port: 7941 clusterGroupMetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "cluster0" currentClusterName: "cluster0" diff --git a/config/development_xdc_cluster1.yaml b/config/development_xdc_cluster1.yaml index 50c4c1cc218..b9043d5d74a 100644 --- a/config/development_xdc_cluster1.yaml +++ b/config/development_xdc_cluster1.yaml @@ -69,7 +69,6 @@ services: port: 8941 clusterGroupMetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "cluster0" currentClusterName: "cluster1" diff --git a/config/development_xdc_cluster2.yaml b/config/development_xdc_cluster2.yaml index a12cf100fc0..0f78d7cd99d 100644 --- a/config/development_xdc_cluster2.yaml +++ b/config/development_xdc_cluster2.yaml @@ -69,7 +69,6 @@ services: port: 9941 clusterGroupMetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "cluster0" currentClusterName: "cluster2" diff --git a/docker/config_template.yaml b/docker/config_template.yaml index e131d4227f4..6ac4405de07 100644 --- a/docker/config_template.yaml +++ b/docker/config_template.yaml @@ -201,7 +201,6 @@ services: {{- end }} clusterGroupMetadata: - enableGlobalDomain: {{ default .Env.ENABLE_GLOBAL_DOMAIN "true" }} clusterRedirectionPolicy: policy: {{ default .Env.CLUSTER_REDIRECT_POLICY "all-domain-apis-forwarding" }} failoverVersionIncrement: 10 diff --git a/host/integrationbase.go b/host/integrationbase.go index 4f01f3521fd..bae27e67a56 100644 --- a/host/integrationbase.go +++ b/host/integrationbase.go @@ -103,7 +103,7 @@ func (s *IntegrationBase) setupSuite() { s.adminClient = NewAdminClient(dispatcher) } else { s.Logger.Info("Running integration test against test cluster") - clusterMetadata := NewClusterMetadata(s.testClusterConfig, s.Logger) + clusterMetadata := NewClusterMetadata(s.testClusterConfig) params := pt.TestBaseParams{ DefaultTestCluster: s.defaultTestCluster, VisibilityTestCluster: s.visibilityTestCluster, diff --git a/host/ndc/integration_test.go b/host/ndc/integration_test.go index 4957ed3130e..1e388017a09 100644 --- a/host/ndc/integration_test.go +++ b/host/ndc/integration_test.go @@ -113,7 +113,7 @@ func (s *NDCIntegrationTestSuite) SetupSuite() { s.mockAdminClient["other"] = mockOtherClient s.clusterConfigs[0].MockAdminClient = s.mockAdminClient - clusterMetadata := host.NewClusterMetadata(s.clusterConfigs[0], s.logger.WithTags(tag.ClusterName(clusterName[0]))) + clusterMetadata := host.NewClusterMetadata(s.clusterConfigs[0]) params := pt.TestBaseParams{ DefaultTestCluster: s.defaultTestCluster, VisibilityTestCluster: s.visibilityTestCluster, diff --git a/host/testcluster.go b/host/testcluster.go index 351b7bf30ad..af94e93d667 100644 --- a/host/testcluster.go +++ b/host/testcluster.go @@ -175,15 +175,10 @@ func noopAuthorizationConfig() config.Authorization { } // NewClusterMetadata returns cluster metdata from config -func NewClusterMetadata(options *TestClusterConfig, logger log.Logger) cluster.Metadata { - clusterMetadata := cluster.GetTestClusterMetadata( - options.ClusterGroupMetadata.EnableGlobalDomain, - options.IsPrimaryCluster, - ) +func NewClusterMetadata(options *TestClusterConfig) cluster.Metadata { + clusterMetadata := cluster.GetTestClusterMetadata(options.IsPrimaryCluster) if !options.IsPrimaryCluster && options.ClusterGroupMetadata.PrimaryClusterName != "" { // xdc cluster metadata setup clusterMetadata = cluster.NewMetadata( - logger, - dynamicconfig.GetBoolPropertyFn(options.ClusterGroupMetadata.EnableGlobalDomain), options.ClusterGroupMetadata.FailoverVersionIncrement, options.ClusterGroupMetadata.PrimaryClusterName, options.ClusterGroupMetadata.CurrentClusterName, diff --git a/host/testdata/ndc_integration_test_clusters.yaml b/host/testdata/ndc_integration_test_clusters.yaml index f87ab47d0a2..423ee6fb8c5 100644 --- a/host/testdata/ndc_integration_test_clusters.yaml +++ b/host/testdata/ndc_integration_test_clusters.yaml @@ -1,7 +1,6 @@ - persistence: dbname: integration_active clustergroupmetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "active" currentClusterName: "active" @@ -67,7 +66,6 @@ - persistence: dbname: integration_standby clustergroupmetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "active" currentClusterName: "standby" @@ -133,7 +131,6 @@ - persistence: dbname: integration_other clustergroupmetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "active" currentClusterName: "other" @@ -171,4 +168,4 @@ clusters: test: brokers: - - "${KAFKA_SEEDS}:9092" \ No newline at end of file + - "${KAFKA_SEEDS}:9092" diff --git a/host/testdata/xdc_integration_es_clusters.yaml b/host/testdata/xdc_integration_es_clusters.yaml index f0c4cb1a872..28afa8d448b 100644 --- a/host/testdata/xdc_integration_es_clusters.yaml +++ b/host/testdata/xdc_integration_es_clusters.yaml @@ -1,7 +1,6 @@ - persistence: dbname: integration_active_es clustergroupmetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "active-es" currentClusterName: "active-es" @@ -68,7 +67,6 @@ - persistence: dbname: integration_standby_es clustergroupmetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "active-es" currentClusterName: "standby-es" @@ -115,4 +113,4 @@ scheme: "http" host: "${ES_SEEDS}:9200" indices: - visibility: test-visibility-1- \ No newline at end of file + visibility: test-visibility-1- diff --git a/host/testdata/xdc_integration_test_clusters.yaml b/host/testdata/xdc_integration_test_clusters.yaml index 4e3864bb839..f3e88ce3250 100644 --- a/host/testdata/xdc_integration_test_clusters.yaml +++ b/host/testdata/xdc_integration_test_clusters.yaml @@ -1,7 +1,6 @@ - persistence: dbname: integration_active clustergroupmetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "active" currentClusterName: "active" @@ -54,7 +53,6 @@ - persistence: dbname: integration_standby clustergroupmetadata: - enableGlobalDomain: true failoverVersionIncrement: 10 primaryClusterName: "active" currentClusterName: "standby" diff --git a/service/frontend/clusterRedirectionHandler_test.go b/service/frontend/clusterRedirectionHandler_test.go index 5c336b519a3..5dc4b30cd35 100644 --- a/service/frontend/clusterRedirectionHandler_test.go +++ b/service/frontend/clusterRedirectionHandler_test.go @@ -98,7 +98,6 @@ func (s *clusterRedirectionHandlerSuite) SetupTest() { s.mockRemoteFrontendClient = s.mockResource.RemoteFrontendClient s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(s.currentClusterName).AnyTimes() - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(true).AnyTimes() s.config = NewConfig( dynamicconfig.NewCollection( diff --git a/service/frontend/clusterRedirectionPolicy_test.go b/service/frontend/clusterRedirectionPolicy_test.go index 2fdc6aa3e21..722d104323c 100644 --- a/service/frontend/clusterRedirectionPolicy_test.go +++ b/service/frontend/clusterRedirectionPolicy_test.go @@ -33,7 +33,6 @@ import ( "github.com/uber/cadence/common/cluster" "github.com/uber/cadence/common/dynamicconfig" "github.com/uber/cadence/common/log/loggerimpl" - "github.com/uber/cadence/common/mocks" "github.com/uber/cadence/common/persistence" "github.com/uber/cadence/common/types" ) @@ -60,8 +59,7 @@ type ( alternativeClusterName string mockConfig *Config - mockClusterMetadata *mocks.ClusterMetadata - policy *selectedOrAllAPIsForwardingRedirectionPolicy + policy *selectedOrAllAPIsForwardingRedirectionPolicy } ) @@ -142,8 +140,6 @@ func (s *selectedAPIsForwardingRedirectionPolicySuite) SetupTest() { false, false, ) - s.mockClusterMetadata = &mocks.ClusterMetadata{} - s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(true) s.policy = newSelectedOrAllAPIsForwardingPolicy( s.currentClusterName, s.mockConfig, diff --git a/service/frontend/service.go b/service/frontend/service.go index 0a8f3cd15fd..3bdbceebeac 100644 --- a/service/frontend/service.go +++ b/service/frontend/service.go @@ -31,7 +31,6 @@ import ( "github.com/uber/cadence/common/definition" "github.com/uber/cadence/common/domain" "github.com/uber/cadence/common/dynamicconfig" - "github.com/uber/cadence/common/messaging" "github.com/uber/cadence/common/resource" "github.com/uber/cadence/common/service" ) @@ -257,16 +256,8 @@ func (s *Service) Start() { logger := s.GetLogger() logger.Info("frontend starting") - var replicationMessageSink messaging.Producer - clusterMetadata := s.GetClusterMetadata() - if clusterMetadata.IsGlobalDomainEnabled() { - replicationMessageSink = s.GetDomainReplicationQueue() - } else { - replicationMessageSink = messaging.NewNoopProducer() - } - // Base handler - s.handler = NewWorkflowHandler(s, s.config, replicationMessageSink, client.NewVersionChecker()) + s.handler = NewWorkflowHandler(s, s.config, s.GetDomainReplicationQueue(), client.NewVersionChecker()) // Additional decorations var handler Handler = s.handler diff --git a/service/frontend/workflowHandler_test.go b/service/frontend/workflowHandler_test.go index 0428ad9162c..a02590de05c 100644 --- a/service/frontend/workflowHandler_test.go +++ b/service/frontend/workflowHandler_test.go @@ -125,7 +125,7 @@ func (s *workflowHandlerSuite) SetupTest() { mockMonitor := s.mockResource.MembershipResolver mockMonitor.EXPECT().MemberCount(service.Frontend).Return(5, nil).AnyTimes() s.mockVersionChecker.EXPECT().ClientSupported(gomock.Any(), gomock.Any()).Return(nil).AnyTimes() - + s.mockClusterMetadata.EXPECT().IsPrimaryCluster().Return(true).AnyTimes() } func (s *workflowHandlerSuite) TearDownTest() { @@ -504,7 +504,6 @@ func (s *workflowHandlerSuite) TestRegisterDomain_Failure_MissingDomainDataKey() } func (s *workflowHandlerSuite) TestRegisterDomain_Failure_InvalidArchivalURI() { - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(false) s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName) s.mockArchivalMetadata.On("GetHistoryConfig").Return(archiver.NewArchivalConfig("enabled", dc.GetStringPropertyFn("enabled"), dc.GetBoolPropertyFn(true), "disabled", "random URI")) s.mockArchivalMetadata.On("GetVisibilityConfig").Return(archiver.NewArchivalConfig("enabled", dc.GetStringPropertyFn("enabled"), dc.GetBoolPropertyFn(true), "disabled", "random URI")) @@ -527,7 +526,6 @@ func (s *workflowHandlerSuite) TestRegisterDomain_Failure_InvalidArchivalURI() { } func (s *workflowHandlerSuite) TestRegisterDomain_Success_EnabledWithNoArchivalURI() { - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(false) s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockArchivalMetadata.On("GetHistoryConfig").Return(archiver.NewArchivalConfig("enabled", dc.GetStringPropertyFn("enabled"), dc.GetBoolPropertyFn(true), "disabled", testHistoryArchivalURI)) @@ -549,7 +547,6 @@ func (s *workflowHandlerSuite) TestRegisterDomain_Success_EnabledWithNoArchivalU } func (s *workflowHandlerSuite) TestRegisterDomain_Success_EnabledWithArchivalURI() { - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(false) s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockArchivalMetadata.On("GetHistoryConfig").Return(archiver.NewArchivalConfig("enabled", dc.GetStringPropertyFn("enabled"), dc.GetBoolPropertyFn(true), "disabled", "invalidURI")) @@ -576,7 +573,6 @@ func (s *workflowHandlerSuite) TestRegisterDomain_Success_EnabledWithArchivalURI } func (s *workflowHandlerSuite) TestRegisterDomain_Success_ClusterNotConfiguredForArchival() { - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(false) s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockArchivalMetadata.On("GetHistoryConfig").Return(archiver.NewDisabledArchvialConfig()) @@ -599,7 +595,6 @@ func (s *workflowHandlerSuite) TestRegisterDomain_Success_ClusterNotConfiguredFo } func (s *workflowHandlerSuite) TestRegisterDomain_Success_NotEnabled() { - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(false) s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockArchivalMetadata.On("GetHistoryConfig").Return(archiver.NewArchivalConfig("enabled", dc.GetStringPropertyFn("enabled"), dc.GetBoolPropertyFn(true), "disabled", "some random URI")) diff --git a/service/history/constants/test_constants.go b/service/history/constants/test_constants.go index 70bbf05930e..b521d78d93f 100644 --- a/service/history/constants/test_constants.go +++ b/service/history/constants/test_constants.go @@ -56,7 +56,7 @@ var ( TestRunID = "0d00698f-08e1-4d36-a3e2-3bf109f5d2d6" // TestClusterMetadata is the cluster metadata for test - TestClusterMetadata = cluster.GetTestClusterMetadata(true, true) + TestClusterMetadata = cluster.GetTestClusterMetadata(true) // TestLocalDomainEntry is the local domain cache entry for test TestLocalDomainEntry = cache.NewLocalDomainCacheEntryForTest( diff --git a/service/history/execution/cache_test.go b/service/history/execution/cache_test.go index 168fdbf10b2..cba30e6fd0d 100644 --- a/service/history/execution/cache_test.go +++ b/service/history/execution/cache_test.go @@ -74,8 +74,6 @@ func (s *historyCacheSuite) SetupTest() { }, config.NewForTest(), ) - - s.mockShard.Resource.ClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(false).AnyTimes() } func (s *historyCacheSuite) TearDownTest() { diff --git a/service/history/execution/state_builder_test.go b/service/history/execution/state_builder_test.go index 1df67b462ea..19495c048b7 100644 --- a/service/history/execution/state_builder_test.go +++ b/service/history/execution/state_builder_test.go @@ -99,7 +99,6 @@ func (s *stateBuilderSuite) SetupTest() { s.mockClusterMetadata = s.mockShard.Resource.ClusterMetadata s.mockEventsCache = s.mockShard.MockEventsCache s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(true).AnyTimes() s.mockEventsCache.EXPECT().PutEvent(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() s.logger = s.mockShard.GetLogger() diff --git a/service/history/historyEngine.go b/service/history/historyEngine.go index 4d561a3a059..565b540eb3d 100644 --- a/service/history/historyEngine.go +++ b/service/history/historyEngine.go @@ -248,20 +248,17 @@ func NewEngineWithShardContext( historyEngImpl.eventsReapplier = ndc.NewEventsReapplier(shard.GetMetricsClient(), logger) - // Only start the replicator processor if global domain is enabled - if shard.GetClusterMetadata().IsGlobalDomainEnabled() { - historyEngImpl.nDCReplicator = ndc.NewHistoryReplicator( - shard, - executionCache, - historyEngImpl.eventsReapplier, - logger, - ) - historyEngImpl.nDCActivityReplicator = ndc.NewActivityReplicator( - shard, - executionCache, - logger, - ) - } + historyEngImpl.nDCReplicator = ndc.NewHistoryReplicator( + shard, + executionCache, + historyEngImpl.eventsReapplier, + logger, + ) + historyEngImpl.nDCActivityReplicator = ndc.NewActivityReplicator( + shard, + executionCache, + logger, + ) historyEngImpl.crossClusterTaskProcessors = task.NewCrossClusterTaskProcessors( shard, diff --git a/service/history/historyEngine2_test.go b/service/history/historyEngine2_test.go index 889cdf08ed0..56b3278342a 100644 --- a/service/history/historyEngine2_test.go +++ b/service/history/historyEngine2_test.go @@ -130,7 +130,6 @@ func (s *engine2Suite) SetupTest() { s.mockDomainCache.EXPECT().GetDomainName(gomock.Any()).Return(constants.TestDomainID, nil).AnyTimes() s.mockEventsCache.EXPECT().PutEvent(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(false).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockClusterMetadata.EXPECT().ClusterNameForFailoverVersion(common.EmptyVersion).Return(cluster.TestCurrentClusterName).AnyTimes() diff --git a/service/history/historyEngine3_eventsv2_test.go b/service/history/historyEngine3_eventsv2_test.go index 414018eda93..c9daf94cffc 100644 --- a/service/history/historyEngine3_eventsv2_test.go +++ b/service/history/historyEngine3_eventsv2_test.go @@ -111,7 +111,6 @@ func (s *engine3Suite) SetupTest() { s.mockDomainCache = s.mockShard.Resource.DomainCache s.mockEventsCache = s.mockShard.MockEventsCache - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(false).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockClusterMetadata.EXPECT().ClusterNameForFailoverVersion(common.EmptyVersion).Return(cluster.TestCurrentClusterName).AnyTimes() s.mockEventsCache.EXPECT().PutEvent(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() diff --git a/service/history/historyEngine_test.go b/service/history/historyEngine_test.go index 47b74379a84..287da05d29b 100644 --- a/service/history/historyEngine_test.go +++ b/service/history/historyEngine_test.go @@ -137,7 +137,6 @@ func (s *engineSuite) SetupTest() { s.mockShardManager = s.mockShard.Resource.ShardMgr s.mockClusterMetadata = s.mockShard.Resource.ClusterMetadata s.mockDomainCache = s.mockShard.Resource.DomainCache - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(false).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestSingleDCClusterInfo).AnyTimes() s.mockClusterMetadata.EXPECT().ClusterNameForFailoverVersion(common.EmptyVersion).Return(cluster.TestCurrentClusterName).AnyTimes() diff --git a/service/history/ndc/activity_replicator_test.go b/service/history/ndc/activity_replicator_test.go index ef2a03b6ffe..00008c448dd 100644 --- a/service/history/ndc/activity_replicator_test.go +++ b/service/history/ndc/activity_replicator_test.go @@ -100,7 +100,6 @@ func (s *activityReplicatorSuite) SetupTest() { s.mockDomainCache = s.mockShard.Resource.DomainCache s.mockExecutionMgr = s.mockShard.Resource.ExecutionMgr s.mockClusterMetadata = s.mockShard.Resource.ClusterMetadata - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(true).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() diff --git a/service/history/queue/cross_cluster_queue_processor.go b/service/history/queue/cross_cluster_queue_processor.go index a126c9e7e1b..9c65165df5b 100644 --- a/service/history/queue/cross_cluster_queue_processor.go +++ b/service/history/queue/cross_cluster_queue_processor.go @@ -103,10 +103,8 @@ func (c *crossClusterQueueProcessor) Start() { return } - if c.shard.GetClusterMetadata().IsGlobalDomainEnabled() { - for _, queueProcessor := range c.queueProcessors { - queueProcessor.Start() - } + for _, queueProcessor := range c.queueProcessors { + queueProcessor.Start() } } diff --git a/service/history/queue/timer_queue_processor.go b/service/history/queue/timer_queue_processor.go index 78f195e3b2c..ac32de28a82 100644 --- a/service/history/queue/timer_queue_processor.go +++ b/service/history/queue/timer_queue_processor.go @@ -51,9 +51,8 @@ type ( historyEngine engine.Engine taskProcessor task.Processor - config *config.Config - isGlobalDomainEnabled bool - currentClusterName string + config *config.Config + currentClusterName string metricsClient metrics.Client logger log.Logger @@ -147,9 +146,8 @@ func NewTimerQueueProcessor( historyEngine: historyEngine, taskProcessor: taskProcessor, - config: config, - isGlobalDomainEnabled: shard.GetClusterMetadata().IsGlobalDomainEnabled(), - currentClusterName: currentClusterName, + config: config, + currentClusterName: currentClusterName, metricsClient: shard.GetMetricsClient(), logger: logger, @@ -172,10 +170,8 @@ func (t *timerQueueProcessor) Start() { } t.activeQueueProcessor.Start() - if t.isGlobalDomainEnabled { - for _, standbyQueueProcessor := range t.standbyQueueProcessors { - standbyQueueProcessor.Start() - } + for _, standbyQueueProcessor := range t.standbyQueueProcessors { + standbyQueueProcessor.Start() } t.shutdownWG.Add(1) @@ -188,10 +184,8 @@ func (t *timerQueueProcessor) Stop() { } t.activeQueueProcessor.Stop() - if t.isGlobalDomainEnabled { - for _, standbyQueueProcessor := range t.standbyQueueProcessors { - standbyQueueProcessor.Stop() - } + for _, standbyQueueProcessor := range t.standbyQueueProcessors { + standbyQueueProcessor.Stop() } close(t.shutdownChan) @@ -393,23 +387,21 @@ func (t *timerQueueProcessor) completeTimer() error { newAckLevel = minTaskKey(newAckLevel, queueState.AckLevel()) } - if t.isGlobalDomainEnabled { - for standbyClusterName := range t.standbyQueueProcessors { - actionResult, err := t.HandleAction(context.Background(), standbyClusterName, NewGetStateAction()) - if err != nil { - return err - } - for _, queueState := range actionResult.GetStateActionResult.States { - newAckLevel = minTaskKey(newAckLevel, queueState.AckLevel()) - } + for standbyClusterName := range t.standbyQueueProcessors { + actionResult, err := t.HandleAction(context.Background(), standbyClusterName, NewGetStateAction()) + if err != nil { + return err } - - for _, failoverInfo := range t.shard.GetAllTimerFailoverLevels() { - failoverLevel := newTimerTaskKey(failoverInfo.MinLevel, 0) - newAckLevel = minTaskKey(newAckLevel, failoverLevel) + for _, queueState := range actionResult.GetStateActionResult.States { + newAckLevel = minTaskKey(newAckLevel, queueState.AckLevel()) } } + for _, failoverInfo := range t.shard.GetAllTimerFailoverLevels() { + failoverLevel := newTimerTaskKey(failoverInfo.MinLevel, 0) + newAckLevel = minTaskKey(newAckLevel, failoverLevel) + } + if newAckLevel == maximumTimerTaskKey { panic("Unable to get timer queue processor ack level") } diff --git a/service/history/queue/transfer_queue_processor.go b/service/history/queue/transfer_queue_processor.go index 37623aa3ecb..7c112dd5b3e 100644 --- a/service/history/queue/transfer_queue_processor.go +++ b/service/history/queue/transfer_queue_processor.go @@ -65,9 +65,8 @@ type ( historyEngine engine.Engine taskProcessor task.Processor - config *config.Config - isGlobalDomainEnabled bool - currentClusterName string + config *config.Config + currentClusterName string metricsClient metrics.Client logger log.Logger @@ -157,9 +156,8 @@ func NewTransferQueueProcessor( historyEngine: historyEngine, taskProcessor: taskProcessor, - config: config, - isGlobalDomainEnabled: shard.GetClusterMetadata().IsGlobalDomainEnabled(), - currentClusterName: currentClusterName, + config: config, + currentClusterName: currentClusterName, metricsClient: shard.GetMetricsClient(), logger: logger, @@ -181,10 +179,8 @@ func (t *transferQueueProcessor) Start() { } t.activeQueueProcessor.Start() - if t.isGlobalDomainEnabled { - for _, standbyQueueProcessor := range t.standbyQueueProcessors { - standbyQueueProcessor.Start() - } + for _, standbyQueueProcessor := range t.standbyQueueProcessors { + standbyQueueProcessor.Start() } t.shutdownWG.Add(1) @@ -197,10 +193,8 @@ func (t *transferQueueProcessor) Stop() { } t.activeQueueProcessor.Stop() - if t.isGlobalDomainEnabled { - for _, standbyQueueProcessor := range t.standbyQueueProcessors { - standbyQueueProcessor.Stop() - } + for _, standbyQueueProcessor := range t.standbyQueueProcessors { + standbyQueueProcessor.Stop() } close(t.shutdownChan) @@ -400,24 +394,22 @@ func (t *transferQueueProcessor) completeTransfer() error { newAckLevel = minTaskKey(newAckLevel, queueState.AckLevel()) } - if t.isGlobalDomainEnabled { - for standbyClusterName := range t.standbyQueueProcessors { - actionResult, err := t.HandleAction(context.Background(), standbyClusterName, NewGetStateAction()) - if err != nil { - return err - } - for _, queueState := range actionResult.GetStateActionResult.States { - newAckLevel = minTaskKey(newAckLevel, queueState.AckLevel()) - } + for standbyClusterName := range t.standbyQueueProcessors { + actionResult, err := t.HandleAction(context.Background(), standbyClusterName, NewGetStateAction()) + if err != nil { + return err + } + for _, queueState := range actionResult.GetStateActionResult.States { + newAckLevel = minTaskKey(newAckLevel, queueState.AckLevel()) } + } - for _, failoverInfo := range t.shard.GetAllTransferFailoverLevels() { - failoverLevel := newTransferTaskKey(failoverInfo.MinLevel) - if newAckLevel == nil { - newAckLevel = failoverLevel - } else { - newAckLevel = minTaskKey(newAckLevel, failoverLevel) - } + for _, failoverInfo := range t.shard.GetAllTransferFailoverLevels() { + failoverLevel := newTransferTaskKey(failoverInfo.MinLevel) + if newAckLevel == nil { + newAckLevel = failoverLevel + } else { + newAckLevel = minTaskKey(newAckLevel, failoverLevel) } } diff --git a/service/history/replication/task_ack_manager_test.go b/service/history/replication/task_ack_manager_test.go index a1d087c28ea..3773d2d50c4 100644 --- a/service/history/replication/task_ack_manager_test.go +++ b/service/history/replication/task_ack_manager_test.go @@ -102,7 +102,6 @@ func (s *taskAckManagerSuite) SetupTest() { s.mockHistoryMgr = s.mockShard.Resource.HistoryMgr s.mockClusterMetadata = s.mockShard.Resource.ClusterMetadata s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(true).AnyTimes() s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() s.logger = s.mockShard.GetLogger() diff --git a/service/history/task/cross_cluster_source_task_executor_test.go b/service/history/task/cross_cluster_source_task_executor_test.go index aa49541c992..7511390ae9f 100644 --- a/service/history/task/cross_cluster_source_task_executor_test.go +++ b/service/history/task/cross_cluster_source_task_executor_test.go @@ -114,7 +114,6 @@ func (s *crossClusterSourceTaskExecutorSuite) SetupTest() { s.mockDomainCache.EXPECT().GetDomainID(constants.TestParentDomainName).Return(constants.TestParentDomainID, nil).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(true).AnyTimes() s.executionCache = execution.NewCache(s.mockShard) s.executor = NewCrossClusterSourceTaskExecutor( diff --git a/service/history/task/cross_cluster_target_task_executor_test.go b/service/history/task/cross_cluster_target_task_executor_test.go index 20302c62ffe..4a883e05800 100644 --- a/service/history/task/cross_cluster_target_task_executor_test.go +++ b/service/history/task/cross_cluster_target_task_executor_test.go @@ -83,7 +83,6 @@ func (s *crossClusterTargetTaskExecutorSuite) SetupTest() { mockClusterMetadata := s.mockShard.Resource.ClusterMetadata mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() - mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(true).AnyTimes() s.executor = NewCrossClusterTargetTaskExecutor(s.mockShard, s.mockShard.GetLogger(), config) } diff --git a/service/history/task/cross_cluster_task_test.go b/service/history/task/cross_cluster_task_test.go index 42dc4cf06a7..10edc03d583 100644 --- a/service/history/task/cross_cluster_task_test.go +++ b/service/history/task/cross_cluster_task_test.go @@ -108,7 +108,6 @@ func (s *crossClusterTaskSuite) SetupTest() { s.mockDomainCache.EXPECT().GetDomainID(constants.TestParentDomainName).Return(constants.TestParentDomainID, nil).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(true).AnyTimes() s.mockExecutor = NewMockExecutor(s.controller) s.mockProcessor = NewMockProcessor(s.controller) diff --git a/service/history/task/task_util.go b/service/history/task/task_util.go index 9f6673f1f09..6506377cece 100644 --- a/service/history/task/task_util.go +++ b/service/history/task/task_util.go @@ -245,10 +245,6 @@ func verifyTaskVersion( task interface{}, ) (bool, error) { - if !shard.GetService().GetClusterMetadata().IsGlobalDomainEnabled() { - return true, nil - } - // the first return value is whether this task is valid for further processing domainEntry, err := shard.GetDomainCache().GetDomainByID(domainID) if err != nil { diff --git a/service/history/task/timer_active_task_executor_test.go b/service/history/task/timer_active_task_executor_test.go index 30a2f4f408a..be22e15cd16 100644 --- a/service/history/task/timer_active_task_executor_test.go +++ b/service/history/task/timer_active_task_executor_test.go @@ -133,7 +133,6 @@ func (s *timerActiveTaskExecutorSuite) SetupTest() { s.mockDomainCache.EXPECT().GetDomainName(gomock.Any()).Return(constants.TestDomainName, nil).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(true).AnyTimes() s.mockClusterMetadata.EXPECT().ClusterNameForFailoverVersion(s.version).Return(s.mockClusterMetadata.GetCurrentClusterName()).AnyTimes() s.logger = s.mockShard.GetLogger() diff --git a/service/history/task/timer_standby_task_executor_test.go b/service/history/task/timer_standby_task_executor_test.go index 056213b22fc..2b90bf6d41d 100644 --- a/service/history/task/timer_standby_task_executor_test.go +++ b/service/history/task/timer_standby_task_executor_test.go @@ -135,7 +135,6 @@ func (s *timerStandbyTaskExecutorSuite) SetupTest() { s.mockDomainCache.EXPECT().GetDomainName(gomock.Any()).Return(constants.TestDomainName, nil).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(true).AnyTimes() s.mockClusterMetadata.EXPECT().ClusterNameForFailoverVersion(s.version).Return(s.clusterName).AnyTimes() s.logger = s.mockShard.GetLogger() diff --git a/service/history/task/transfer_active_task_executor_test.go b/service/history/task/transfer_active_task_executor_test.go index 6bf30ed9bb7..2f265f7433e 100644 --- a/service/history/task/transfer_active_task_executor_test.go +++ b/service/history/task/transfer_active_task_executor_test.go @@ -193,7 +193,6 @@ func (s *transferActiveTaskExecutorSuite) SetupTest() { s.mockDomainCache.EXPECT().GetDomain(s.childDomainName).Return(s.childDomainEntry, nil).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(true).AnyTimes() s.mockClusterMetadata.EXPECT().ClusterNameForFailoverVersion(s.version).Return(s.mockClusterMetadata.GetCurrentClusterName()).AnyTimes() s.logger = s.mockShard.GetLogger() diff --git a/service/history/task/transfer_standby_task_executor_test.go b/service/history/task/transfer_standby_task_executor_test.go index c698d860d5c..26726dabdf9 100644 --- a/service/history/task/transfer_standby_task_executor_test.go +++ b/service/history/task/transfer_standby_task_executor_test.go @@ -150,7 +150,6 @@ func (s *transferStandbyTaskExecutorSuite) SetupTest() { s.mockDomainCache.EXPECT().GetDomainID(constants.TestChildDomainName).Return(constants.TestChildDomainID, nil).AnyTimes() s.mockClusterMetadata.EXPECT().GetCurrentClusterName().Return(cluster.TestCurrentClusterName).AnyTimes() s.mockClusterMetadata.EXPECT().GetAllClusterInfo().Return(cluster.TestAllClusterInfo).AnyTimes() - s.mockClusterMetadata.EXPECT().IsGlobalDomainEnabled().Return(true).AnyTimes() s.mockClusterMetadata.EXPECT().ClusterNameForFailoverVersion(s.version).Return(s.clusterName).AnyTimes() s.logger = s.mockShard.GetLogger() diff --git a/service/matching/taskListManager_test.go b/service/matching/taskListManager_test.go index b4b0dddf7c7..cd55eaf9126 100644 --- a/service/matching/taskListManager_test.go +++ b/service/matching/taskListManager_test.go @@ -318,7 +318,7 @@ func TestAddTaskStandby(t *testing.T) { }, }, 1234, - cluster.GetTestClusterMetadata(true, true), + cluster.GetTestClusterMetadata(true), ) mockDomainCache := tlm.domainCache.(*cache.MockDomainCache) mockDomainCache.EXPECT().GetDomainByID(domainID).Return(testStandbyDomainEntry, nil).AnyTimes() diff --git a/service/worker/esanalyzer/analyzer_test.go b/service/worker/esanalyzer/analyzer_test.go index df29a1b3b5e..ee810562cda 100644 --- a/service/worker/esanalyzer/analyzer_test.go +++ b/service/worker/esanalyzer/analyzer_test.go @@ -98,7 +98,7 @@ func (s *esanalyzerWorkflowTestSuite) SetupTest() { }, }, 1234, - cluster.GetTestClusterMetadata(true, true), + cluster.GetTestClusterMetadata(true), ) s.config = Config{ diff --git a/service/worker/service.go b/service/worker/service.go index 971926f4b4f..901685aea7b 100644 --- a/service/worker/service.go +++ b/service/worker/service.go @@ -225,9 +225,8 @@ func (s *Service) Start() { s.startIndexer() } - if s.GetClusterMetadata().IsGlobalDomainEnabled() { - s.startReplicator() - } + s.startReplicator() + if s.GetArchivalMetadata().GetHistoryConfig().ClusterConfiguredForArchival() { s.startArchiver() } diff --git a/service/worker/shadower/workflow_test.go b/service/worker/shadower/workflow_test.go index 3c0d5aca745..b8c17108089 100644 --- a/service/worker/shadower/workflow_test.go +++ b/service/worker/shadower/workflow_test.go @@ -85,7 +85,7 @@ func (s *workflowSuite) SetupTest() { }, }, 1234, - cluster.GetTestClusterMetadata(true, true), + cluster.GetTestClusterMetadata(true), ) s.mockDomainCache.EXPECT().GetDomain(testActiveDomainName).Return(activeDomainCache, nil).AnyTimes() @@ -100,7 +100,7 @@ func (s *workflowSuite) SetupTest() { }, }, 1234, - cluster.GetTestClusterMetadata(true, true), + cluster.GetTestClusterMetadata(true), ) s.mockDomainCache.EXPECT().GetDomain(testStandbyDomainName).Return(standbyDomainCache, nil).AnyTimes() diff --git a/tools/cli/domainUtils.go b/tools/cli/domainUtils.go index 2fc14f1d4b3..f0aba56bb3f 100644 --- a/tools/cli/domainUtils.go +++ b/tools/cli/domainUtils.go @@ -241,10 +241,7 @@ func initializeAdminDomainHandler( metricsClient := initializeMetricsClient() logger := initializeLogger(configuration) - clusterMetadata := initializeClusterMetadata( - configuration, - logger, - ) + clusterMetadata := initializeClusterMetadata(configuration) metadataMgr := initializeDomainManager(context) dynamicConfig := initializeDynamicConfig(configuration, logger) return initializeDomainHandler( @@ -305,15 +302,10 @@ func initializeLogger( return loggerimpl.NewLogger(zapLogger) } -func initializeClusterMetadata( - serviceConfig *config.Config, - logger log.Logger, -) cluster.Metadata { +func initializeClusterMetadata(serviceConfig *config.Config) cluster.Metadata { clusterGroupMetadata := serviceConfig.ClusterGroupMetadata return cluster.NewMetadata( - logger, - dynamicconfig.GetBoolPropertyFn(clusterGroupMetadata.EnableGlobalDomain), clusterGroupMetadata.FailoverVersionIncrement, clusterGroupMetadata.PrimaryClusterName, clusterGroupMetadata.CurrentClusterName,