Skip to content

Commit

Permalink
Fix circular dependency issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Wenquan Xing committed Jan 24, 2019
1 parent ff08ecb commit 140c70c
Show file tree
Hide file tree
Showing 16 changed files with 248 additions and 57 deletions.
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ install-schema-cdc: bins
./cadence-cassandra-tool --ep 127.0.0.1 create -k cadence_visibility_active --rf 1
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_active setup-schema -v 0.0
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_active update-schema -d ./schema/cassandra/visibility/versioned

@echo Setting up cadence_standby key space
./cadence-cassandra-tool --ep 127.0.0.1 create -k cadence_standby --rf 1
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_standby setup-schema -v 0.0
Expand All @@ -202,8 +203,19 @@ install-schema-cdc: bins
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_standby setup-schema -v 0.0
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_standby update-schema -d ./schema/cassandra/visibility/versioned

@echo Setting up cadence_other key space
./cadence-cassandra-tool --ep 127.0.0.1 create -k cadence_other --rf 1
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_other setup-schema -v 0.0
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_other update-schema -d ./schema/cassandra/cadence/versioned
./cadence-cassandra-tool --ep 127.0.0.1 create -k cadence_visibility_other --rf 1
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_other setup-schema -v 0.0
./cadence-cassandra-tool -ep 127.0.0.1 -k cadence_visibility_other update-schema -d ./schema/cassandra/visibility/versioned

start-cdc-active: bins
./cadence-server --zone active start

start-cdc-standby: bins
./cadence-server --zone standby start

start-cdc-other: bins
./cadence-server --zone other start
2 changes: 1 addition & 1 deletion common/service/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type (
// ClustersInfo is the config containing all valid clusters and active cluster
ClustersInfo ClustersInfo `yaml:"clustersInfo"`
// DCRedirectionPolicy contains the frontend datacenter redirection policy
DCRedirectionPolicy DCRedirectionPolicy `yaml:"dcRrediectionPolicy"`
DCRedirectionPolicy DCRedirectionPolicy `yaml:"dcRedirectionPolicy"`
// Services is a map of service name to service config items
Services map[string]Service `yaml:"services"`
// Kafka is the config for connecting to kafka
Expand Down
2 changes: 1 addition & 1 deletion common/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import (
"github.com/uber-common/bark"
"github.com/uber-go/tally"
"github.com/uber/cadence/common/elasticsearch"
ringpop "github.com/uber/ringpop-go"
"github.com/uber/ringpop-go"
"go.uber.org/yarpc"
)

Expand Down
2 changes: 1 addition & 1 deletion config/development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ clustersInfo:
rpcName: "cadence-frontend"
rpcAddress: "127.0.0.1:7933"

dcRrediectionPolicy:
dcRedirectionPolicy:
policy: "noop"
fromDC: ""
toDC: ""
Expand Down
16 changes: 15 additions & 1 deletion config/development_active.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,19 @@ clustersInfo:
clusterInitialFailoverVersion:
active: 1
standby: 0
other: 2
clusterAddress:
active:
rpcName: "cadence-frontend"
rpcAddress: "127.0.0.1:7933"
standby:
rpcName: "cadence-frontend"
rpcAddress: "127.0.0.1:8933"
other:
rpcName: "cadence-frontend"
rpcAddress: "127.0.0.1:9933"

dcRrediectionPolicy:
dcRedirectionPolicy:
policy: "noop"
fromDC: ""
toDC: ""
Expand All @@ -104,6 +108,12 @@ kafka:
cluster: test
standby-dlq:
cluster: test
other:
cluster: test
other-retry:
cluster: test
other-dlq:
cluster: test
cadence-cluster-topics:
active:
topic: active
Expand All @@ -113,6 +123,10 @@ kafka:
topic: standby
retry-topic: standby-retry
dlq-topic: standby-dlq
other:
topic: other
retry-topic: other-retry
dlq-topic: other-dlq

archival:
enabled: true
Expand Down
145 changes: 145 additions & 0 deletions config/development_other.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
persistence:
defaultStore: cass-default
visibilityStore: cass-visibility
numHistoryShards: 1
datastores:
cass-default:
cassandra:
hosts: "127.0.0.1"
keyspace: "cadence_other"
consistency: "One"
cass-visibility:
cassandra:
hosts: "127.0.0.1"
keyspace: "cadence_visibility_other"
consistency: "One"

ringpop:
name: cadence_other
bootstrapMode: hosts
bootstrapHosts: ["127.0.0.1:9933", "127.0.0.1:9934", "127.0.0.1:9935", "127.0.0.1:9940"]
maxJoinDuration: 30s

services:
frontend:
rpc:
port: 9933
bindOnLocalHost: true
metrics:
statsd:
hostPort: "127.0.0.1:8125"
prefix: "cadence_other"
pprof:
port: 9936

matching:
rpc:
port: 9935
bindOnLocalHost: true
metrics:
statsd:
hostPort: "127.0.0.1:8125"
prefix: "cadence_other"
pprof:
port: 9938

history:
rpc:
port: 9934
bindOnLocalHost: true
metrics:
statsd:
hostPort: "127.0.0.1:8125"
prefix: "cadence_other"
pprof:
port: 9937

worker:
rpc:
port: 9940
bindOnLocalHost: true
metrics:
statsd:
hostPort: "127.0.0.1:8125"
prefix: "cadence_other"
pprof:
port: 9941

clustersInfo:
enableGlobalDomain: true
failoverVersionIncrement: 10
masterClusterName: "active"
currentClusterName: "other"
clusterInitialFailoverVersion:
active: 1
standby: 0
other: 2
clusterAddress:
active:
rpcName: "cadence-frontend"
rpcAddress: "127.0.0.1:7933"
standby:
rpcName: "cadence-frontend"
rpcAddress: "127.0.0.1:8933"
other:
rpcName: "cadence-frontend"
rpcAddress: "127.0.0.1:9933"

dcRedirectionPolicy:
policy: "forwarding"
fromDC: "other"
toDC: "active"

kafka:
clusters:
test:
brokers:
- 127.0.0.1:9092
topics:
active:
cluster: test
active-retry:
cluster: test
active-dlq:
cluster: test
standby:
cluster: test
standby-retry:
cluster: test
standby-dlq:
cluster: test
other:
cluster: test
other-retry:
cluster: test
other-dlq:
cluster: test
cadence-cluster-topics:
active:
topic: active
retry-topic: active-retry
dlq-topic: active-dlq
standby:
topic: standby
retry-topic: standby-retry
dlq-topic: standby-dlq
other:
topic: other
retry-topic: other-retry
dlq-topic: other-dlq

archival:
enabled: true
filestore:
storeDirectory: "/tmp/dev_standby/blobstore/"
defaultBucket:
name: "cadence-development"
owner: "cadence"
retentionDays: 10
customBuckets:
- name: "custom-bucket-1"
owner: "custom-owner-1"
retentionDays: 10
- name: "custom-bucket-2"
owner: "custom-owner-2"
retentionDays: 5
16 changes: 15 additions & 1 deletion config/development_standby.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,19 @@ clustersInfo:
clusterInitialFailoverVersion:
active: 1
standby: 0
other: 2
clusterAddress:
active:
rpcName: "cadence-frontend"
rpcAddress: "127.0.0.1:7933"
standby:
rpcName: "cadence-frontend"
rpcAddress: "127.0.0.1:8933"
other:
rpcName: "cadence-frontend"
rpcAddress: "127.0.0.1:9933"

dcRrediectionPolicy:
dcRedirectionPolicy:
policy: "noop"
fromDC: ""
toDC: ""
Expand All @@ -104,6 +108,12 @@ kafka:
cluster: test
standby-dlq:
cluster: test
other:
cluster: test
other-retry:
cluster: test
other-dlq:
cluster: test
cadence-cluster-topics:
active:
topic: active
Expand All @@ -113,6 +123,10 @@ kafka:
topic: standby
retry-topic: standby-retry
dlq-topic: standby-dlq
other:
topic: other
retry-topic: other-retry
dlq-topic: other-dlq

archival:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion docker/config_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ clustersInfo:
rpcName: "cadence-frontend"
rpcAddress: "127.0.0.1:7933"

dcRrediectionPolicy:
dcRedirectionPolicy:
policy: "noop"
fromDC: ""
toDC: ""
Expand Down
2 changes: 1 addition & 1 deletion host/onebox.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ func (c *cadenceImpl) GetFrontendService() service.Service {
func (c *cadenceImpl) startFrontend(rpHosts []string, startWG *sync.WaitGroup) {
params := new(service.BootstrapParams)
params.DCRedirectionPolicy = config.DCRedirectionPolicy{
Policy: frontend.DCRredirectionPolicyNoop,
Policy: frontend.DCRedirectionPolicyNoop,
}
params.Name = common.FrontendServiceName
params.Logger = c.logger
Expand Down
2 changes: 1 addition & 1 deletion service/frontend/adminHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (adh *AdminHandler) Start() error {
adh.Service.GetDispatcher().Register(adminserviceserver.New(adh))
adh.Service.Start()

adh.history = adh.Service.GetClientBean().GetHistoryClient()
adh.history = adh.GetClientBean().GetHistoryClient()
adh.metricsClient = adh.Service.GetMetricsClient()
adh.startWG.Done()
return nil
Expand Down
Loading

0 comments on commit 140c70c

Please sign in to comment.