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

Add EngineConfig extensions to EnginePlugin #1387

Merged

Conversation

nknize
Copy link
Collaborator

@nknize nknize commented Oct 19, 2021

This PR adds an extension point to EngineConfig through EnginePlugin using
a new EngineConfigFactory mechanism. EnginePlugin provides interface methods to
override configurations in EngineConfig. The EngineConfigFactory produces a new
instance of the EngineConfig using these overrides. Defaults are used absent
overridden configurations.

This serves as a mechanism to override Engine configurations (e.g., CodecService,
TranslogConfig) enabling Plugins to have higher fidelity for changing Engine
behavior without having to override the entire Engine (which is only permitted for
a single plugin).

This commit adds an extension point to EngineConfig through EnginePlugin using
a new EngineConfigFactory mechanism. EnginePlugin provides interface methods to
override configurations in EngineConfig. The EngineConfigFactory produces a new
instance of the EngineConfig using these overrides. Defaults are used absent
overridden configurations.

This serves as a mechanism to override TranslogConfig and CodecService enabling
Plugins to have higher fidelity for changing Engine configurations without
having to override the entire Engine.

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
@nknize nknize added enhancement Enhancement or improvement to existing feature or request v2.0.0 Version 2.0.0 distributed framework v1.2.0 Issues related to version 1.2.0 labels Oct 19, 2021
@opensearch-ci-bot
Copy link
Collaborator

Can one of the admins verify this patch?

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success ee4aaf8

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed ee4aaf8

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Precommit failure ee4aaf8
Log 1344

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success df28fdf

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed df28fdf

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success df28fdf

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 767847e82cd12645ce6e60d70c24ea2090a56906

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success 767847e82cd12645ce6e60d70c24ea2090a56906

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
@nknize nknize force-pushed the enginePlugin/EngineConfigFactory branch from 767847e to a116d3a Compare October 19, 2021 19:31
@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed a116d3a

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success a116d3a

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Precommit failure 767847e82cd12645ce6e60d70c24ea2090a56906
Log 1346

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success a116d3a

@nknize
Copy link
Collaborator Author

nknize commented Oct 19, 2021

start gradle check

@nknize nknize requested a review from adnapibar October 19, 2021 19:39
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
@nknize
Copy link
Collaborator Author

nknize commented Oct 19, 2021

start gradle check

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Wrapper Validation success 6394df6

@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 6394df6

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Precommit success 6394df6

@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure a116d3a
Log 733

Reports 733

@reta
Copy link
Collaborator

reta commented Oct 19, 2021

x Gradle Check failure a116d3a Log 733

Reports 733

@nknize should be fixed by #1390

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 6394df6
Log 734

Reports 734

Copy link
Contributor

@adnapibar adnapibar left a comment

Choose a reason for hiding this comment

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

👍

* A factory to create an EngineConfig based on custom plugin overrides
*/
public class EngineConfigFactory {
private final Optional<CodecService> codecService;
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't need to be declared with Optional

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was mostly for the logic on L111.

this.codecService.isPresent() ? this.codecService.get() : codecService;

instead of

this.codecService != null ? this.codecService : codecService;

Which feels a little clumsy?

@nknize nknize merged commit ecac8d3 into opensearch-project:main Oct 20, 2021
@nknize nknize added the pending backport Identifies an issue or PR that still needs to be backported label Oct 21, 2021
nknize added a commit to nknize/OpenSearch that referenced this pull request Oct 21, 2021
This commit adds an extension point to EngineConfig through EnginePlugin using
a new EngineConfigFactory mechanism. EnginePlugin provides interface methods to
override configurations in EngineConfig. The EngineConfigFactory produces a new
instance of the EngineConfig using these overrides. Defaults are used absent
overridden configurations.

This serves as a mechanism to override Engine configurations (e.g., CodecService,
TranslogConfig) enabling Plugins to have higher fidelity for changing Engine
behavior without having to override the entire Engine (which is only permitted for
a single plugin).

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
nknize added a commit that referenced this pull request Oct 21, 2021
This commit adds an extension point to EngineConfig through EnginePlugin using
a new EngineConfigFactory mechanism. EnginePlugin provides interface methods to
override configurations in EngineConfig. The EngineConfigFactory produces a new
instance of the EngineConfig using these overrides. Defaults are used absent
overridden configurations.

This serves as a mechanism to override Engine configurations (e.g., CodecService,
TranslogConfig) enabling Plugins to have higher fidelity for changing Engine
behavior without having to override the entire Engine (which is only permitted for
a single plugin).

Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
@dblock
Copy link
Member

dblock commented Dec 6, 2021

Does this still need to be backported?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
distributed framework enhancement Enhancement or improvement to existing feature or request pending backport Identifies an issue or PR that still needs to be backported v1.2.0 Issues related to version 1.2.0 v2.0.0 Version 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants