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

[Feature/extensions] Adding support to register settings dynamically #3753

Conversation

saratvemulapalli
Copy link
Member

Description

Adding support to register dynamic settings.
For plugins/extensions, they can define their own settings which are propagated across the cluster.
This PR adds support to register Node Scope or Index Scope settings at anytime.
This feature support unlocks a part of extensions hot swap.

This is a recreate of PR: #3529

Issues Resolved

#3434

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@saratvemulapalli saratvemulapalli requested review from a team and reta as code owners July 1, 2022 00:05
@saratvemulapalli
Copy link
Member Author

Tagging: @kartg (follow up of our conversation)

@github-actions
Copy link
Contributor

github-actions bot commented Jul 1, 2022

Gradle Check (Jenkins) Run Completed with:

@dblock
Copy link
Member

dblock commented Jul 5, 2022

Any downsides for this implementation at runtime? I hope we can get this onto main.

@saratvemulapalli
Copy link
Member Author

Gradle Check (Jenkins) Run Completed with:

This is a bug #2772 on feature/extensions branch.

Tests with failures:
 - org.opensearch.cluster.remote.test.RemoteClustersIT.testSniffModeConnectionFails

@saratvemulapalli
Copy link
Member Author

Any downsides for this implementation at runtime? I hope we can get this onto main.

I am looking for feedback as well. As far as I understand it feels safe enough.
I would love to get this to main.

@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

A few more comments inline. It looks like this is still a work in progress so holding off on clicking "approve".

Signed-off-by: Sarat Vemulapalli <[email protected]>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Signed-off-by: Sarat Vemulapalli <[email protected]>
@github-actions
Copy link
Contributor

Gradle Check (Jenkins) Run Completed with:

Copy link
Member

@dbwiddis dbwiddis left a comment

Choose a reason for hiding this comment

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

LGTM!

@dbwiddis
Copy link
Member

dbwiddis commented Jul 16, 2022

Gradle check failing on Jenkins. I think I read somewhere that Jenkins configuration has changed, so that's unrelated to this PR but probably should hold off merging until we get that updated.

@saratvemulapalli saratvemulapalli merged commit 9b29039 into opensearch-project:feature/extensions Jul 16, 2022
@@ -144,6 +144,15 @@ protected AbstractScopedSettings(Settings nodeSettings, Settings scopeSettings,
settingUpdaters.addAll(other.settingUpdaters);
}

protected boolean registerSetting(Setting<?> setting) {
Copy link
Member

Choose a reason for hiding this comment

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

Given that ClusterSettings and IndexScopedSettings are the only two subclasses of this class, why not simply make this method public and avoid the super calls in two places?

if (setting.hasNodeScope()) {
return clusterSettings.registerSetting(setting);
}
if (setting.hasIndexScope()) {
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick - else if here, unless it's possible for a setting to be both NodeScope and IndexScope

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure.

if (setting.hasIndexScope()) {
return indexScopedSettings.registerSetting(setting);
}
logger.info("Registered new Setting: " + setting.getKey() + " successfully ");
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick - This log line will be printed inconsistently since there are return statements above. Consider moving this to the caller, or before the return statements

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for this. The return came later after the feedback.
Sure will send out a follow up.

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.

4 participants