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

Correctly determine defaults of settings which depend on other settings #65989

Merged

Conversation

gwbrown
Copy link
Contributor

@gwbrown gwbrown commented Dec 7, 2020

This commit adjusts the behavior when calculating the diff between two
AbstractScopedSettings objects, so that the default values of settings
whose default values depend on the values of other settings are
correctly calculated. Previously, when calculating the diff, the default
value of a depended setting would be calculated based on the default
value of the setting(s) it depends on, rather than the current value of
those settings.

Fixes #47890

This commit adjusts the behavior when calculating the diff between two
`AbstractScopedSettings` objects, so that the default values of settings
whose default values depend on the values of other settings are
correctly calculated. Previously, when calculating the diff, the default
value of a depended setting would be calculated based on the default
value of the setting(s) it depends on, rather than the current value of
those settings.
@elasticmachine elasticmachine added the Team:Core/Infra Meta label for core/infra team label Dec 7, 2020
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

LGTM, one suggestion

@@ -486,7 +486,11 @@ private T get(Settings settings, boolean validate) {
* @param defaultSettings the default settings object to diff against
*/
public void diff(Settings.Builder builder, Settings source, Settings defaultSettings) {
if (exists(source) == false) {
if (exists(source) == false && exists(defaultSettings) == false) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this might read better if the outer "doesn't exist in source" stays the same and then have two inner conditions for "if (exists in defaults) X else Y"

@gwbrown gwbrown merged commit d566f87 into elastic:master Dec 8, 2020
@gwbrown gwbrown deleted the fix-diff-of-dependent-default-settings branch December 8, 2020 19:08
gwbrown added a commit to gwbrown/elasticsearch that referenced this pull request Dec 8, 2020
…gs (elastic#65989)

This commit adjusts the behavior when calculating the diff between two
`AbstractScopedSettings` objects, so that the default values of settings
whose default values depend on the values of other settings are
correctly calculated. Previously, when calculating the diff, the default
value of a depended setting would be calculated based on the default
value of the setting(s) it depends on, rather than the current value of
those settings.
gwbrown added a commit to gwbrown/elasticsearch that referenced this pull request Dec 8, 2020
…gs (elastic#65989)

This commit adjusts the behavior when calculating the diff between two
`AbstractScopedSettings` objects, so that the default values of settings
whose default values depend on the values of other settings are
correctly calculated. Previously, when calculating the diff, the default
value of a depended setting would be calculated based on the default
value of the setting(s) it depends on, rather than the current value of
those settings.
gwbrown added a commit that referenced this pull request Dec 8, 2020
… settings (#65989)

This commit adjusts the behavior when calculating the diff between two
`AbstractScopedSettings` objects, so that the default values of settings
whose default values depend on the values of other settings are
correctly calculated. Previously, when calculating the diff, the default
value of a depended setting would be calculated based on the default
value of the setting(s) it depends on, rather than the current value of
those settings.
gwbrown added a commit that referenced this pull request Dec 8, 2020
…settings (#65989)

This commit adjusts the behavior when calculating the diff between two
`AbstractScopedSettings` objects, so that the default values of settings
whose default values depend on the values of other settings are
correctly calculated. Previously, when calculating the diff, the default
value of a depended setting would be calculated based on the default
value of the setting(s) it depends on, rather than the current value of
those settings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Core/Infra/Settings Settings infrastructure and APIs Team:Core/Infra Meta label for core/infra team v7.10.2 v7.11.0 v8.0.0-alpha1
Projects
None yet
4 participants