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

Allow InternalEngine to be stopped and started #8784

Closed
wants to merge 3 commits into from

Conversation

bleskes
Copy link
Contributor

@bleskes bleskes commented Dec 4, 2014

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

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

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?

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 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.

@s1monw
Copy link
Contributor

s1monw commented Dec 8, 2014

left some minor naming comments - other than than LGTM

@bleskes
Copy link
Contributor Author

bleskes commented Dec 8, 2014

@s1monw I pushed an update. Also note the breaking name in settings constants names.

@s1monw
Copy link
Contributor

s1monw commented Dec 8, 2014

LGTM

@bleskes bleskes closed this in 83bb65a Dec 8, 2014
bleskes added a commit to bleskes/elasticsearch that referenced this pull request Dec 8, 2014
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
@bleskes bleskes deleted the engine_impl branch December 10, 2014 10:57
s1monw added a commit to s1monw/elasticsearch that referenced this pull request Dec 10, 2014
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.
s1monw added a commit to s1monw/elasticsearch that referenced this pull request Dec 10, 2014
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
@clintongormley clintongormley changed the title Internal: allow InternalEngine to be stopped and started Allow InternalEngine to be stopped and started Jun 7, 2015
@clintongormley clintongormley added :Distributed Indexing/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. :Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. and removed :Engine :Distributed Indexing/Distributed A catch all label for anything in the Distributed Area. Please avoid if you can. labels Feb 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Distributed Indexing/Engine Anything around managing Lucene and the Translog in an open shard. >enhancement resiliency v1.5.0 v2.0.0-beta1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants