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

Update the default values of dynamic config to not depend on static config #4858

Merged
merged 2 commits into from
Jun 15, 2022

Conversation

Shaddoll
Copy link
Member

@Shaddoll Shaddoll commented Jun 6, 2022

What changed?

Update the default values of dynamic config to be static values, and to not depend on values read from static config file

Why?

  • Dynamic config and static config should be independent of each other
  • With this change we can create a source of truth to store the default values of dynamic config

How did you test it?
existing test

Potential risks

Release notes
If there is no system.grpcMaxSizeInByte config, it needs to be created. And the value should be the same as the maxPayloadSize in the static config.

Documentation Changes

@Shaddoll Shaddoll force-pushed the dynamic-static branch 5 times, most recently from 3f9fbd6 to 50b8f7b Compare June 6, 2022 23:29
@Shaddoll Shaddoll changed the title [WIP]Update the default values of dynamic config to not depend on static c… Update the default values of dynamic config to not depend on static config Jun 6, 2022
@coveralls
Copy link

coveralls commented Jun 6, 2022

Pull Request Test Coverage Report for Build 018164f2-c139-4d55-894d-efce07aeb87b

  • 8 of 9 (88.89%) changed or added relevant lines in 6 files are covered.
  • 77 unchanged lines in 10 files lost coverage.
  • Overall coverage decreased (-0.05%) to 57.976%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/server/cadence/server.go 0 1 0.0%
Files with Coverage Reduction New Missed Lines %
common/membership/hashring.go 2 83.54%
common/persistence/nosql/nosqlplugin/cassandra/workflow.go 3 57.59%
common/task/fifoTaskScheduler.go 3 84.54%
common/persistence/visibilityDualManager.go 4 57.39%
service/history/task/fetcher.go 4 91.28%
common/persistence/nosql/nosqlplugin/cassandra/workflowUtils.go 8 77.95%
common/persistence/nosql/nosqlExecutionStore.go 9 61.26%
common/persistence/nosql/nosqlplugin/cassandra/tasks.go 14 72.8%
common/persistence/nosql/nosqlplugin/cassandra/workflowParsingUtils.go 14 87.37%
common/persistence/nosql/nosqlTaskStore.go 16 58.37%
Totals Coverage Status
Change from base Build 018164df-48de-4d4d-94eb-42a78aaf1428: -0.05%
Covered Lines: 83958
Relevant Lines: 144814

💛 - Coveralls

@@ -55,7 +55,8 @@ type (
archivalConfig struct {
staticClusterStatus ArchivalStatus
dynamicClusterStatus dynamicconfig.StringPropertyFn
enableRead dynamicconfig.BoolPropertyFn
staticEnableRead bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand what these two values are intended to imply from the user of the config.

what does dynamicEnableRead == true and staticEnalbleRead mean, for example? Is this something you're intending to hide through a getter (I might have missed it if you have).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it's hided through ReadEnabled() bool. if both are true, read is enabled

@@ -177,7 +183,7 @@ func (a *archivalConfig) ReadEnabled() bool {
if !a.ClusterConfiguredForArchival() {
return false
}
return a.enableRead()
return a.staticEnableRead && a.dynamicEnableRead()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This configuration might be surprising as some folks might expect either || or if dynamicConfig != nil return dynamicConfig else staticConfig

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont have a strong opinion on what it should be as I don't know enough about how this and similar config values are used in production, but I think maybe we should call out this both in the head of the diff and maybe in comments?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to keep the behavior the same as GetClusterStatus function

@Shaddoll Shaddoll force-pushed the dynamic-static branch 3 times, most recently from 6dc1a8b to b05ee62 Compare June 13, 2022 23:30
Copy link
Member

@davidporter-id-au davidporter-id-au left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I'm mildly worried this might manifest in some behaviour changes, but maybe we can use Steven's config dump to detect this.

@@ -117,7 +117,7 @@ func (cf *rpcClientFactory) NewHistoryClientWithTimeout(timeout time.Duration) (
peerResolver := history.NewPeerResolver(cf.numberOfHistoryShards, cf.resolver, namedPort)

supportedMessageSize := cf.rpcFactory.GetMaxMessageSize()
maxSizeConfig := cf.dynConfig.GetIntProperty(dynamicconfig.GRPCMaxSizeInByte, supportedMessageSize)
maxSizeConfig := cf.dynConfig.GetIntProperty(dynamicconfig.GRPCMaxSizeInByte, 4*1024*1024)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe could we put 4*1024*1024 as a constant too? it's not super clear to the ignorant reader (me) what this refers to?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will be addressed in #4863

@Shaddoll Shaddoll merged commit e8a06cc into cadence-workflow:master Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants