Skip to content

Conversation

@alexey-ivanov-es
Copy link
Contributor

No description provided.

@elasticsearchmachine
Copy link
Collaborator

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(
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@elasticsearchmachine elasticsearchmachine added the serverless-linked Added by automation, don't add manually label Apr 23, 2025
@alexey-ivanov-es alexey-ivanov-es removed the serverless-linked Added by automation, don't add manually label Apr 23, 2025
@alexey-ivanov-es
Copy link
Contributor Author

Reopened as #127280

return this;
}

public Settings settings() {
Copy link
Contributor

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?

Copy link
Contributor Author

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) {
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done: #127280

@alexey-ivanov-es alexey-ivanov-es deleted the per-project-settings branch April 23, 2025 18:57
@@ -0,0 +1,5 @@
pr: 127252
summary: New per-project only settings can be defined and used by components
Copy link
Contributor

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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(
Copy link
Contributor

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.

Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Core/Infra/Settings Settings infrastructure and APIs >feature v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants