Skip to content

Commit

Permalink
clientVersionCheck: disable by default, enable for localhost devel (c…
Browse files Browse the repository at this point in the history
  • Loading branch information
venkat1109 authored Jun 11, 2019
1 parent 0f57f64 commit b3f82d5
Show file tree
Hide file tree
Showing 16 changed files with 29 additions and 14 deletions.
4 changes: 4 additions & 0 deletions config/dynamicconfig/development.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@
# - false
# - key4: true
# key5: 2.0

# enable this only for localhost development
frontend.enableClientVersionCheck:
- value: true
1 change: 1 addition & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ docker run -e CASSANDRA_CONSISTENCY=Quorum \ -- Default cassandra con
-e NUM_HISTORY_SHARDS=1024 \ -- Number of history shards
-e SERVICES=history,matching \ -- Spinup only the provided services
-e LOG_LEVEL=debug,info \ -- Logging level
-e DYNAMIC_CONFIG_FILE_PATH=config/foo.yaml -- Dynamic config file to be watched
ubercadence/server:<tag>
```

6 changes: 5 additions & 1 deletion docker/config_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,8 @@ archival:
retentionDays: 5

publicClient:
hostPort: ${BIND_ON_IP}:7933
hostPort: ${BIND_ON_IP}:7933

dynamicConfigClient:
filepath: ${DYNAMIC_CONFIG_FILE_PATH}
pollInterval: "60s"
6 changes: 5 additions & 1 deletion docker/config_template_mysql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,8 @@ archival:
retentionDays: 5

publicClient:
hostPort: ${BIND_ON_IP}:7933
hostPort: ${BIND_ON_IP}:7933

dynamicConfigClient:
filepath: ${DYNAMIC_CONFIG_FILE_PATH}
pollInterval: "60s"
1 change: 1 addition & 0 deletions docker/docker-compose-mysql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ services:
- "MYSQL_PWD=root"
- "MYSQL_SEEDS=mysql"
- "STATSD_ENDPOINT=statsd:8125"
- "DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development.yaml"
depends_on:
- mysql
- statsd
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ services:
environment:
- "CASSANDRA_SEEDS=cassandra"
- "STATSD_ENDPOINT=statsd:8125"
- "DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development.yaml"
depends_on:
- cassandra
- statsd
Expand Down
2 changes: 1 addition & 1 deletion docker/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export KEYSPACE="${KEYSPACE:-cadence}"
export VISIBILITY_KEYSPACE="${VISIBILITY_KEYSPACE:-cadence_visibility}"
export CASSANDRA_CONSISTENCY="${CASSANDRA_CONSISTENCY:-One}"

#mysql env
# mysql env
export DBNAME="${DBNAME:-cadence}"
export VISIBILITY_DBNAME="${VISIBILITY_DBNAME:-cadence_visibility}"
export DB_PORT=${DB_PORT:-3306}
Expand Down
2 changes: 1 addition & 1 deletion host/onebox.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ func (c *cadenceImpl) startFrontend(hosts map[string][]string, startWG *sync.Wai
c.adminHandler.RegisterHandler()

dc := dynamicconfig.NewCollection(params.DynamicConfig, c.logger)
frontendConfig := frontend.NewConfig(dc, c.historyConfig.NumHistoryShards, c.workerConfig.EnableIndexer, true)
frontendConfig := frontend.NewConfig(dc, c.historyConfig.NumHistoryShards, c.workerConfig.EnableIndexer)
c.frontendHandler = frontend.NewWorkflowHandler(
c.frontEndService, frontendConfig, c.metadataMgr, c.historyMgr, c.historyV2Mgr,
c.visibilityMgr, kafkaProducer, params.BlobstoreClient)
Expand Down
2 changes: 1 addition & 1 deletion service/frontend/dcRedirectionHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (s *dcRedirectionHandlerSuite) SetupTest() {
s.domainID = "some random domain ID"
s.currentClusterName = cluster.TestCurrentClusterName
s.alternativeClusterName = cluster.TestAlternativeClusterName
s.config = NewConfig(dynamicconfig.NewCollection(dynamicconfig.NewNopClient(), s.logger), 0, false, false)
s.config = NewConfig(dynamicconfig.NewCollection(dynamicconfig.NewNopClient(), s.logger), 0, false)
s.mockMetadataMgr = &mocks.MetadataManager{}

s.mockClusterMetadata = &mocks.ClusterMetadata{}
Expand Down
2 changes: 1 addition & 1 deletion service/frontend/dcRedirectionPolicy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (s *selectedAPIsForwardingRedirectionPolicySuite) SetupTest() {
logger, err := loggerimpl.NewDevelopment()
s.Nil(err)

s.mockConfig = NewConfig(dynamicconfig.NewCollection(dynamicconfig.NewNopClient(), logger), 0, false, false)
s.mockConfig = NewConfig(dynamicconfig.NewCollection(dynamicconfig.NewNopClient(), logger), 0, false)
s.mockMetadataMgr = &mocks.MetadataManager{}
s.mockClusterMetadata = &mocks.ClusterMetadata{}
s.mockClusterMetadata.On("IsGlobalDomainEnabled").Return(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func (s *domainHandlerGlobalDomainDisabledSuite) TearDownSuite() {

func (s *domainHandlerGlobalDomainDisabledSuite) SetupTest() {
logger := loggerimpl.NewNopLogger()
s.config = NewConfig(dc.NewCollection(dc.NewNopClient(), logger), numHistoryShards, false, false)
s.config = NewConfig(dc.NewCollection(dc.NewNopClient(), logger), numHistoryShards, false)
s.metadataMgr = s.TestBase.MetadataProxy
s.mockBlobstoreClient = &mocks.BlobstoreClient{}
s.mockProducer = &mocks.KafkaProducer{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (s *domainHandlerGlobalDomainEnabledMasterClusterSuite) TearDownSuite() {

func (s *domainHandlerGlobalDomainEnabledMasterClusterSuite) SetupTest() {
logger := loggerimpl.NewNopLogger()
s.config = NewConfig(dc.NewCollection(dc.NewNopClient(), logger), numHistoryShards, false, false)
s.config = NewConfig(dc.NewCollection(dc.NewNopClient(), logger), numHistoryShards, false)
s.metadataMgr = s.TestBase.MetadataProxy
s.mockBlobstoreClient = &mocks.BlobstoreClient{}
s.mockProducer = &mocks.KafkaProducer{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (s *domainHandlerGlobalDomainEnabledNotMasterClusterSuite) TearDownSuite()

func (s *domainHandlerGlobalDomainEnabledNotMasterClusterSuite) SetupTest() {
logger := loggerimpl.NewNopLogger()
s.config = NewConfig(dc.NewCollection(dc.NewNopClient(), logger), numHistoryShards, false, false)
s.config = NewConfig(dc.NewCollection(dc.NewNopClient(), logger), numHistoryShards, false)
s.metadataMgr = s.TestBase.MetadataProxy
s.mockBlobstoreClient = &mocks.BlobstoreClient{}
s.mockProducer = &mocks.KafkaProducer{}
Expand Down
2 changes: 1 addition & 1 deletion service/frontend/domainHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (s *domainHandlerCommonSuite) TearDownSuite() {

func (s *domainHandlerCommonSuite) SetupTest() {
logger := loggerimpl.NewNopLogger()
s.config = NewConfig(dc.NewCollection(dc.NewNopClient(), logger), numHistoryShards, false, false)
s.config = NewConfig(dc.NewCollection(dc.NewNopClient(), logger), numHistoryShards, false)
s.metadataMgr = s.TestBase.MetadataProxy
s.mockBlobstoreClient = &mocks.BlobstoreClient{}
s.mockProducer = &mocks.KafkaProducer{}
Expand Down
6 changes: 3 additions & 3 deletions service/frontend/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type Config struct {
}

// NewConfig returns new service config with default values
func NewConfig(dc *dynamicconfig.Collection, numHistoryShards int, enableVisibilityToKafka bool, enableClientVersionCheck bool) *Config {
func NewConfig(dc *dynamicconfig.Collection, numHistoryShards int, enableVisibilityToKafka bool) *Config {
return &Config{
NumHistoryShards: numHistoryShards,
PersistenceMaxQPS: dc.GetIntProperty(dynamicconfig.FrontendPersistenceMaxQPS, 2000),
Expand All @@ -106,7 +106,7 @@ func NewConfig(dc *dynamicconfig.Collection, numHistoryShards int, enableVisibil
BlobSizeLimitWarn: dc.GetIntPropertyFilteredByDomain(dynamicconfig.BlobSizeLimitWarn, 256*1024),
ThrottledLogRPS: dc.GetIntProperty(dynamicconfig.FrontendThrottledLogRPS, 20),
EnableDomainNotActiveAutoForwarding: dc.GetBoolPropertyFnWithDomainFilter(dynamicconfig.EnableDomainNotActiveAutoForwarding, false),
EnableClientVersionCheck: dc.GetBoolProperty(dynamicconfig.EnableClientVersionCheck, enableClientVersionCheck),
EnableClientVersionCheck: dc.GetBoolProperty(dynamicconfig.EnableClientVersionCheck, false),
ValidSearchAttributes: dc.GetMapProperty(dynamicconfig.ValidSearchAttributes, definition.GetDefaultIndexedKeys()),
SearchAttributesNumberOfKeysLimit: dc.GetIntPropertyFilteredByDomain(dynamicconfig.SearchAttributesNumberOfKeysLimit, 20),
SearchAttributesSizeOfValueLimit: dc.GetIntPropertyFilteredByDomain(dynamicconfig.SearchAttributesSizeOfValueLimit, 2*1024),
Expand All @@ -123,7 +123,7 @@ type Service struct {

// NewService builds a new cadence-frontend service
func NewService(params *service.BootstrapParams) common.Daemon {
config := NewConfig(dynamicconfig.NewCollection(params.DynamicConfig, params.Logger), params.PersistenceConfig.NumHistoryShards, params.ESConfig.Enable, true)
config := NewConfig(dynamicconfig.NewCollection(params.DynamicConfig, params.Logger), params.PersistenceConfig.NumHistoryShards, params.ESConfig.Enable)
params.ThrottledLogger = loggerimpl.NewThrottledLogger(params.Logger, config.ThrottledLogRPS)
params.UpdateLoggerWithServiceName(common.FrontendServiceName)
return &Service{
Expand Down
2 changes: 1 addition & 1 deletion service/frontend/workflowHandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1203,7 +1203,7 @@ func (s *workflowHandlerSuite) TestCountWorkflowExecutions() {
}

func (s *workflowHandlerSuite) newConfig() *Config {
return NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger), numHistoryShards, false, false)
return NewConfig(dc.NewCollection(dc.NewNopClient(), s.logger), numHistoryShards, false)
}

func bucketMetadataResponse(owner string, retentionDays int) *blobstore.BucketMetadataResponse {
Expand Down

0 comments on commit b3f82d5

Please sign in to comment.