-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Allow InternalEngine to be stopped and started #8784
Conversation
Once the current engine is started you can only close it once. Once closed the engine cannot be started again. This commit adds a stop method which signals the engine to free it's resources but in a way that allows restarting. This is done by making InternalEngine a wrapper around InternalEngineImpl which maintains the start once, close once semantics. This allows to add the stop() method without adding complexity the engine implementation. InternalEngine is maintained as an entry point for listeners (incoming and outgoing) to other ES components, which abliviated the needs add/remove them if the engine is stopped.
@@ -16,87 +16,33 @@ | |||
* specific language governing permissions and limitations |
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 don't like the Foo
/ FooImpl
pattern. I think the actual engine should be called InternalEngine
and the configuration / holder part should be called InternalEngineDelegate
or InternalEngineHolder
or so?
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 didn't like the delegate naming because it's not really just a wrapper. I changed it to Holder now. The only down side I see is that the settings now have a different name (InternalEngineHolder#INDEX_FAIL_ON_MERGE_FAILURE
and not InternalEngine#INDEX_FAIL_ON_MERGE_FAILURE
). I think I'm good with this breaking change but pointing out.
left some minor naming comments - other than than LGTM |
@s1monw I pushed an update. Also note the breaking name in settings constants names. |
LGTM |
Once the current engine is started you can only close it once. Once closed the engine cannot be started again. This commit adds a stop method which signals the engine to free it's resources but in a way that allows restarting. This is done by introducing InternalEngineHolder which is a wrapper around InternalEngine. This allows to add the stop() method without adding complexity the engine implementation. InternalEngineHolder also serves an entry point for listeners (incoming and outgoing) to other ES components, which removes the needs add/remove them if the engine is stopped. Closes elastic#8784
After the refactoring in elastic#8784 some settings didn't get passed to the actual engine and there exists a race if the settings are updated while the engine is started such that the actual starting engine doesn't see the latest settings. This commit fixes the concurrency issue as well as adds tests to ensure the settings are reflected.
After the refactoring in elastic#8784 some settings didn't get passed to the actual engine and there exists a race if the settings are updated while the engine is started such that the actual starting engine doesn't see the latest settings. This commit fixes the concurrency issue as well as adds tests to ensure the settings are reflected. Conflicts: src/main/java/org/elasticsearch/index/engine/internal/InternalEngine.java src/main/java/org/elasticsearch/index/engine/internal/InternalEngineHolder.java src/test/java/org/elasticsearch/index/engine/internal/InternalEngineTests.java
Once the current engine is started you can only close it once. Once closed the engine cannot be started again. This commit adds a stop method which signals the engine to free it's resources but in a way that allows restarting.
This is done by introducing InternalEngineHolder which is a wrapper around InternalEngine. This allows to add the stop() method without adding complexity the engine implementation. InternalEngineHolder also serves an entry point for listeners (incoming and outgoing) to other ES components, which removes the needs add/remove them if the engine is stopped.
Needed for #8720