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

Resolving unused settings bug when plugin is disabled #10246

Merged
merged 3 commits into from
Feb 10, 2017

Conversation

kobelb
Copy link
Contributor

@kobelb kobelb commented Feb 8, 2017

When a plugin is disabled, we were previously removing the plugin's schema and all the settings. This was causing as issue when trying to determine which settings were specified in the .yml but are unused in the following code:

return difference(keys(transformDeprecations(settings)), keys(configValues));

I was struggling to think of a scenario where leaving the settings in the config when a plugin is disabled would cause an issue, because the plugin itself shouldn't be loaded and using these settings. The only thing that I could come up with was if a plugin was disabled, and another plugin was somehow using the settings without checking to see if it was 'enabled' this could potentially cause an issue.

@spalger
Copy link
Contributor

spalger commented Feb 8, 2017

if a plugin was disabled, and another plugin was somehow using the settings without checking to see if it was 'enabled' this could potentially cause an issue.

This is definitely something I want to avoid... Do you have any ideas about how this could be solved without removing the unset logic?

@kobelb
Copy link
Contributor Author

kobelb commented Feb 8, 2017

If we could potentially determine the list of disabled plugins, we could concatenate their config prefix with the list of active settings and diff against this. This would require the config's complete step to know about disabled plugins, which isn't ideal.

Or when we disabled a plugin, we could overwrite the config schema and values with a simple schema/value that only had 'enabled: false'. We could also try to use the config defaults, and set enabled to false, but that seems like it has the same issue as not removing them.

There might be others, but those are the first two that I thought of.

@kobelb
Copy link
Contributor Author

kobelb commented Feb 8, 2017

We could also reintroduce the mutable 'pendingSets' approach to keep track of unused settings.

@spalger
Copy link
Contributor

spalger commented Feb 8, 2017

Or when we disabled a plugin, we could overwrite the config schema and values with a simple schema/value that only had 'enabled: false'. We could also try to use the config defaults, and set enabled to false, but that seems like it has the same issue as not removing them.

I actually like that a lot. It still prevents access to config entries like config.get('elasticsearch.url') when the plugin is disabled, and it doesn't require any more awareness of the config than necessary in getUnusedSettings()

@kobelb
Copy link
Contributor Author

kobelb commented Feb 8, 2017

I will make it so! Thanks @spalger

Copy link
Contributor

@spalger spalger left a comment

Choose a reason for hiding this comment

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

LGTM

@kobelb kobelb merged commit 133e160 into elastic:master Feb 10, 2017
elastic-jasper added a commit that referenced this pull request Feb 10, 2017
Backports PR #10246

**Commit 1:**
Resolving unused settings bug when plugin is disabled

* Original sha: c829139
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-06T14:33:24Z

**Commit 2:**
Revert "Resolving unused settings bug when plugin is disabled"

This reverts commit c829139.

* Original sha: 81538f4
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-08T22:16:45Z

**Commit 3:**
Replacing a disabled plugin's config with a simple schema/config with enabled set to false

* Original sha: 7e66762
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-08T22:28:41Z
elastic-jasper added a commit that referenced this pull request Feb 10, 2017
Backports PR #10246

**Commit 1:**
Resolving unused settings bug when plugin is disabled

* Original sha: c829139
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-06T14:33:24Z

**Commit 2:**
Revert "Resolving unused settings bug when plugin is disabled"

This reverts commit c829139.

* Original sha: 81538f4
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-08T22:16:45Z

**Commit 3:**
Replacing a disabled plugin's config with a simple schema/config with enabled set to false

* Original sha: 7e66762
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-08T22:28:41Z
kobelb pushed a commit that referenced this pull request Feb 10, 2017
Backports PR #10246

**Commit 1:**
Resolving unused settings bug when plugin is disabled

* Original sha: c829139
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-06T14:33:24Z

**Commit 2:**
Revert "Resolving unused settings bug when plugin is disabled"

This reverts commit c829139.

* Original sha: 81538f4
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-08T22:16:45Z

**Commit 3:**
Replacing a disabled plugin's config with a simple schema/config with enabled set to false

* Original sha: 7e66762
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-08T22:28:41Z
kobelb pushed a commit that referenced this pull request Feb 10, 2017
Backports PR #10246

**Commit 1:**
Resolving unused settings bug when plugin is disabled

* Original sha: c829139
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-06T14:33:24Z

**Commit 2:**
Revert "Resolving unused settings bug when plugin is disabled"

This reverts commit c829139.

* Original sha: 81538f4
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-08T22:16:45Z

**Commit 3:**
Replacing a disabled plugin's config with a simple schema/config with enabled set to false

* Original sha: 7e66762
* Authored by kobelb <brandon.kobel@elastic.co> on 2017-02-08T22:28:41Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants