-
Notifications
You must be signed in to change notification settings - Fork 25.6k
New per-project only settings can be defined and used by components #127252
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
Conversation
|
Hi @alexey-ivanov-es, I've created a changelog YAML for you. |
| Settings.Builder builder = Settings.builder().put(knownAndValidPersistentSettings); | ||
|
|
||
| // TODO: apply only dynamic? | ||
| boolean changed = scopedSettings.updateSettings( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we update only dynamic settings here? It seems that for new projects, we can set static settings here, but for existing projects, only dynamic settings can be updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe so. It seems updateSettings() is specifically for index settings so we should be using updateDynamicSettings() here.
|
Reopened as #127280 |
| return this; | ||
| } | ||
|
|
||
| public Settings settings() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having accessor methods on Builder seems kinda odd to me. We had to have passed this in already, so why not just hold a reference to what we pass to settings() instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: #127280
| return this.settings; | ||
| } | ||
|
|
||
| public ProjectMetadata.Builder settings(Settings settings) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need to qualify this here. We can just use Builder as the type was we do elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: #127280
| @@ -0,0 +1,5 @@ | |||
| pr: 127252 | |||
| summary: New per-project only settings can be defined and used by components | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't designed to be user-facing, so I wouldn't flag this as a feature for inclusion in release notes.
| * Updates transient and persistent cluster state settings if there are any changes | ||
| * due to the update. | ||
| */ | ||
| public final class SettingsUpdater { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we might want something specific for project settings rather than re-use this class which is quite specific to cluster settings. Specifically updateProjectSettings only makes sense for project settings, and transient settings are only applicable to ClusterSettings.
I think we should introduce a separate class here for per-project settings. We can refactor shared code into an AbstractSettingsUpdator if necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done here: #127280
| return clusterState; | ||
| } | ||
|
|
||
| public synchronized ProjectMetadata updateProjectSettings( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're going to want to use more granular locking here instead of marking this method synchronized. This should be scoped to the project instead of cluster wide. We can safely call this concurrently for different projects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll remove synchronized from this method when I move it to a separate class - it was there originally because updateSettings has it too. In our case, ProjectSettingsUpdater doesn't have any mutable state and is not shared between threads at all, so it doesn't make sense to keep it synchronized
No description provided.