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

settings: allow overriding the default for settings #40429

Merged
merged 2 commits into from
Sep 10, 2019

Conversation

andreimatei
Copy link
Contributor

Release note: None

@cockroach-teamcity
Copy link
Member

This change is Reviewable

@darinpp
Copy link
Contributor

darinpp commented Sep 9, 2019

Looks fine. I do prefer slightly the simpler solution (that is currently in the branch) that doesn't require changing each of the setting classes.
Don't you need to change all setting classes in your case? StringSetting and StateMachineSetting as well?

Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

There's two reason why I've done it this way:

  1. Ergonomics. I think it's much nicer to change the default for a setting only by calling methods on that setting (instead of also having to interact with a SV)
  2. Consistency. Dealing with defaults values is already the responsibility of the different Setting implementations (the setToDefault() methods).

Don't you need to change all setting classes in your case? StringSetting and StateMachineSetting as well?

I don't need to. The Override method is not part of the Setting interface, and nor should it be. For StateMachineSetting in particular, there's no notion of a "default", so there should also not be a notion of overriding it. That's another plus if this patch vs the alternative.

I'll merge this also because it's more ready then the alternative - it's its own commit (which it has to be) and it has a test :p

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @RaduBerinde)

@craig
Copy link
Contributor

craig bot commented Sep 9, 2019

Build failed

This test was polluting the global Registry which was causing any
subsequent test to panic.

Release note: None
Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

failure because of broken/polluting existing test. Fixed in a separate new commit.

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @RaduBerinde)

@craig
Copy link
Contributor

craig bot commented Sep 9, 2019

Build failed

Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @RaduBerinde)

@craig
Copy link
Contributor

craig bot commented Sep 10, 2019

Build failed

Copy link
Contributor Author

@andreimatei andreimatei left a comment

Choose a reason for hiding this comment

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

failure is some TCL flake, although I can't say what exactly

bors r+

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (waiting on @RaduBerinde)

craig bot pushed a commit that referenced this pull request Sep 10, 2019
40429: settings: allow overriding the default for settings r=andreimatei a=andreimatei

Release note: None

Co-authored-by: Andrei Matei <andrei@cockroachlabs.com>
@craig
Copy link
Contributor

craig bot commented Sep 10, 2019

Build succeeded

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