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

make register domain aware of active cluster name #576

Merged
merged 1 commit into from
Feb 23, 2018
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
5 changes: 2 additions & 3 deletions .gen/go/shared/idl.go

Large diffs are not rendered by default.

40 changes: 38 additions & 2 deletions .gen/go/shared/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion host/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,15 @@ func (s *integrationSuite) TestIntegrationRegisterGetDomain_NoDefault() {
email := "some random email"
retention := int32(7)
emitMetric := true
activeClusterName := ""
clusters := []*workflow.ClusterReplicationConfiguration{}
for clusterName := range s.ClusterMetadata.GetAllClusterNames() {
clusters = append(clusters, &workflow.ClusterReplicationConfiguration{
ClusterName: common.StringPtr(clusterName),
})
if clusterName != s.ClusterMetadata.GetCurrentClusterName() {
activeClusterName = clusterName
}
}

err := s.engine.RegisterDomain(createContext(), &workflow.RegisterDomainRequest{
Expand All @@ -214,6 +218,7 @@ func (s *integrationSuite) TestIntegrationRegisterGetDomain_NoDefault() {
WorkflowExecutionRetentionPeriodInDays: common.Int32Ptr(retention),
EmitMetric: common.BoolPtr(emitMetric),
Clusters: clusters,
ActiveClusterName: common.StringPtr(activeClusterName),
})
s.Nil(err)

Expand All @@ -227,7 +232,7 @@ func (s *integrationSuite) TestIntegrationRegisterGetDomain_NoDefault() {
s.Equal(email, resp.DomainInfo.GetOwnerEmail())
s.Equal(retention, resp.Configuration.GetWorkflowExecutionRetentionPeriodInDays())
s.Equal(emitMetric, resp.Configuration.GetEmitMetric())
s.Equal(s.ClusterMetadata.GetCurrentClusterName(), resp.ReplicationConfiguration.GetActiveClusterName())
s.Equal(activeClusterName, resp.ReplicationConfiguration.GetActiveClusterName())
s.Equal(clusters, resp.ReplicationConfiguration.Clusters)
}

Expand Down
1 change: 1 addition & 0 deletions idl/github.com/uber/cadence/shared.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ struct RegisterDomainRequest {
40: optional i32 workflowExecutionRetentionPeriodInDays
50: optional bool emitMetric
60: optional list<ClusterReplicationConfiguration> clusters
70: optional string activeClusterName
}

struct DescribeDomainRequest {
Expand Down
6 changes: 6 additions & 0 deletions service/frontend/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,12 @@ func (wh *WorkflowHandler) RegisterDomain(ctx context.Context, registerRequest *
// input validation on cluster names
clusterMetadata := wh.GetClusterMetadata()
activeClusterName := clusterMetadata.GetCurrentClusterName()
if registerRequest.ActiveClusterName != nil {
activeClusterName = registerRequest.GetActiveClusterName()
if err := wh.validateClusterName(activeClusterName); err != nil {
return wh.error(err, scope)
}
}
clusters := []*persistence.ClusterReplicationConfig{}
for _, cluster := range registerRequest.Clusters {
clusterName := cluster.GetClusterName()
Expand Down