Skip to content

Commit

Permalink
Update worker replication config (#3373)
Browse files Browse the repository at this point in the history
  • Loading branch information
yux0 committed Aug 1, 2020
1 parent 98e14e9 commit 6e9fea4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions common/service/dynamicconfig/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ var keys = map[Key]string{
WorkerReplicationTaskContextDuration: "worker.replicationTaskContextDuration",
WorkerReReplicationContextTimeout: "worker.workerReReplicationContextTimeout",
WorkerEnableRPCReplication: "worker.enableWorkerRPCReplication",
WorkerEnableHistoryReplication: "worker.enableWorkerHistoryReplication",
WorkerEnableKafkaReplication: "worker.enableKafkaReplication",
WorkerIndexerConcurrency: "worker.indexerConcurrency",
WorkerESProcessorNumOfWorkers: "worker.ESProcessorNumOfWorkers",
WorkerESProcessorBulkActions: "worker.ESProcessorBulkActions",
Expand Down Expand Up @@ -720,8 +720,8 @@ const (
WorkerReReplicationContextTimeout
// WorkerEnableRPCReplication is the feature flag for RPC replication
WorkerEnableRPCReplication
// WorkerEnableHistoryReplication is the feature flag for history replication
WorkerEnableHistoryReplication
// WorkerEnableKafkaReplication is the feature flag for kafka replication
WorkerEnableKafkaReplication
// WorkerIndexerConcurrency is the max concurrent messages to be processed at any given time
WorkerIndexerConcurrency
// WorkerESProcessorNumOfWorkers is num of workers for esProcessor
Expand Down
10 changes: 4 additions & 6 deletions service/worker/replicator/replicator.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ type (
ReplicationTaskContextTimeout dynamicconfig.DurationPropertyFn
ReReplicationContextTimeout dynamicconfig.DurationPropertyFnWithDomainIDFilter
EnableRPCReplication dynamicconfig.BoolPropertyFn
EnableHistoryReplication dynamicconfig.BoolPropertyFn
EnableKafkaReplication dynamicconfig.BoolPropertyFn
}
)

Expand Down Expand Up @@ -146,11 +146,9 @@ func (r *Replicator) Start() error {
}
}

if r.config.EnableHistoryReplication() {
for _, processor := range r.processors {
if err := processor.Start(); err != nil {
return err
}
for _, processor := range r.processors {
if err := processor.Start(); err != nil {
return err
}
}
for _, domainProcessor := range r.domainProcessors {
Expand Down
4 changes: 2 additions & 2 deletions service/worker/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func NewConfig(params *service.BootstrapParams) *Config {
ReplicationTaskContextTimeout: dc.GetDurationProperty(dynamicconfig.WorkerReplicationTaskContextDuration, 30*time.Second),
ReReplicationContextTimeout: dc.GetDurationPropertyFilteredByDomainID(dynamicconfig.WorkerReReplicationContextTimeout, 0*time.Second),
EnableRPCReplication: dc.GetBoolProperty(dynamicconfig.WorkerEnableRPCReplication, false),
EnableHistoryReplication: dc.GetBoolProperty(dynamicconfig.WorkerEnableRPCReplication, true),
EnableKafkaReplication: dc.GetBoolProperty(dynamicconfig.WorkerEnableKafkaReplication, false),
},
ArchiverConfig: &archiver.Config{
ArchiverConcurrency: dc.GetIntProperty(dynamicconfig.WorkerArchiverConcurrency, 50),
Expand Down Expand Up @@ -189,7 +189,7 @@ func (s *Service) Start() {
s.startIndexer()
}

if s.GetClusterMetadata().IsGlobalDomainEnabled() {
if s.GetClusterMetadata().IsGlobalDomainEnabled() && s.config.ReplicationCfg.EnableKafkaReplication() {
s.startReplicator()
}
if s.GetArchivalMetadata().GetHistoryConfig().ClusterConfiguredForArchival() {
Expand Down

0 comments on commit 6e9fea4

Please sign in to comment.