-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add EngineConfig extensions to EnginePlugin #1387
Conversation
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>
Can one of the admins verify this patch? |
✅ Gradle Wrapper Validation success ee4aaf8 |
✅ DCO Check Passed ee4aaf8 |
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
✅ Gradle Wrapper Validation success df28fdf |
✅ DCO Check Passed df28fdf |
✅ Gradle Precommit success df28fdf |
server/src/main/java/org/opensearch/index/shard/IndexShard.java
Outdated
Show resolved
Hide resolved
test/framework/src/main/java/org/opensearch/index/shard/IndexShardTestCase.java
Show resolved
Hide resolved
✅ DCO Check Passed 767847e82cd12645ce6e60d70c24ea2090a56906 |
✅ Gradle Wrapper Validation success 767847e82cd12645ce6e60d70c24ea2090a56906 |
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
767847e
to
a116d3a
Compare
✅ DCO Check Passed a116d3a |
✅ Gradle Wrapper Validation success a116d3a |
❌ Gradle Precommit failure 767847e82cd12645ce6e60d70c24ea2090a56906 |
✅ Gradle Precommit success a116d3a |
start gradle check |
Signed-off-by: Nicholas Walter Knize <nknize@apache.org>
start gradle check |
✅ Gradle Wrapper Validation success 6394df6 |
✅ DCO Check Passed 6394df6 |
✅ Gradle Precommit success 6394df6 |
server/src/main/java/org/opensearch/index/engine/EngineConfigFactory.java
Show resolved
Hide resolved
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.
👍
* A factory to create an EngineConfig based on custom plugin overrides | ||
*/ | ||
public class EngineConfigFactory { | ||
private final Optional<CodecService> codecService; |
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 doesn't need to be declared with Optional
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 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?
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>
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>
Does this still need to be backported? |
This PR adds an extension point to
EngineConfig
throughEnginePlugin
usinga new
EngineConfigFactory
mechanism.EnginePlugin
provides interface methods tooverride configurations in
EngineConfig
. TheEngineConfigFactory
produces a newinstance of the
EngineConfig
using these overrides. Defaults are used absentoverridden configurations.
This serves as a mechanism to override Engine configurations (e.g.,
CodecService
,TranslogConfig
) enabling Plugins to have higher fidelity for changing Enginebehavior without having to override the entire
Engine
(which is only permitted fora single plugin).