Add support in plugins for a separate spi classloader#76288
Merged
elasticsearchmachine merged 5 commits intoelastic:masterfrom Aug 11, 2021
Merged
Add support in plugins for a separate spi classloader#76288elasticsearchmachine merged 5 commits intoelastic:masterfrom
elasticsearchmachine merged 5 commits intoelastic:masterfrom
Conversation
SPI is how plugins provide extension points for other plugins to customize their behavior. Plugins may have a separate SPI jar, so as not to expose the internals of the plugin implementation. In essense, this system was built as a stopgap for Java modules, where implementation can be protected in the same jar. However, currently the plugins service loads both spi and plugin implementations into the same classloader. This means that although another plugin may only compile against spi, they could still get jar hell from a duplicate dependency. This commit adds support for plugins to contain an "spi" subdirectory which is loaded into a separate classloader. This spi classloader is a parent to the plugin implementation, as well as any other plugins which have extended it. Additionally as a demonstration of how this works in practice, lang-painless is setup as the first plugin to provide an spi jar, and sql's dependence on painless is changed to only spi, so that it now has an independent version of antlr. closes elastic#74448
Collaborator
|
Pinging @elastic/es-core-infra (Team:Core/Infra) |
Member
Author
|
@elasticmachine run elasticsearch-ci/packaging-tests-windows-sample |
breskeby
reviewed
Aug 11, 2021
modules/lang-painless/build.gradle
Outdated
| tasks.register("apiJavadoc", Javadoc) { | ||
| source = sourceSets.main.allJava | ||
| classpath = sourceSets.main.runtimeClasspath | ||
| classpath = sourceSets.main.runtimeClasspath + configurations.named("spi").classpath |
Contributor
There was a problem hiding this comment.
I think you can simplify this by just using configurations.spi here
breskeby
approved these changes
Aug 11, 2021
Contributor
breskeby
left a comment
There was a problem hiding this comment.
lgtm. just minor style remark
Collaborator
💔 Backport failed
To backport manually run |
costin
added a commit
to costin/elasticsearch
that referenced
this pull request
Aug 11, 2021
Following elastic#76288, upgrade ANTLR library to benefit from the various improvements made in most recent releases in particular better performance and error messages. Looking at the changelog, since version 4.7.2 most changes in ANTLR seem to have occurred in non-Java targets however this commit upgrades to ANTLR 4.9.2 to benefit from the dependency updates (such as StringTemplate). Additionally move the library into QL to consolidate its use across QL projects. Relates elastic#74448 Fix elastic#76354
rjernst
added a commit
to rjernst/elasticsearch
that referenced
this pull request
Aug 11, 2021
SPI is how plugins provide extension points for other plugins to customize their behavior. Plugins may have a separate SPI jar, so as not to expose the internals of the plugin implementation. In essense, this system was built as a stopgap for Java modules, where implementation can be protected in the same jar. However, currently the plugins service loads both spi and plugin implementations into the same classloader. This means that although another plugin may only compile against spi, they could still get jar hell from a duplicate dependency. This commit adds support for plugins to contain an "spi" subdirectory which is loaded into a separate classloader. This spi classloader is a parent to the plugin implementation, as well as any other plugins which have extended it. Additionally as a demonstration of how this works in practice, lang-painless is setup as the first plugin to provide an spi jar, and sql's dependence on painless is changed to only spi, so that it now has an independent version of antlr. closes elastic#74448
elasticsearchmachine
pushed a commit
that referenced
this pull request
Aug 11, 2021
SPI is how plugins provide extension points for other plugins to customize their behavior. Plugins may have a separate SPI jar, so as not to expose the internals of the plugin implementation. In essense, this system was built as a stopgap for Java modules, where implementation can be protected in the same jar. However, currently the plugins service loads both spi and plugin implementations into the same classloader. This means that although another plugin may only compile against spi, they could still get jar hell from a duplicate dependency. This commit adds support for plugins to contain an "spi" subdirectory which is loaded into a separate classloader. This spi classloader is a parent to the plugin implementation, as well as any other plugins which have extended it. Additionally as a demonstration of how this works in practice, lang-painless is setup as the first plugin to provide an spi jar, and sql's dependence on painless is changed to only spi, so that it now has an independent version of antlr. closes #74448
Closed
elasticsearchmachine
pushed a commit
that referenced
this pull request
Aug 11, 2021
* QL: Upgrade ANTLR and move it into QL Following #76288, upgrade ANTLR library to benefit from the various improvements made in most recent releases in particular better performance and error messages. Looking at the changelog, since version 4.7.2 most changes in ANTLR seem to have occurred in non-Java targets however this commit upgrades to ANTLR 4.9.2 to benefit from the dependency updates (such as StringTemplate). Additionally move the library into QL to consolidate its use across QL projects. Relates #74448 Fix #76354 * Fix matching on error message Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
costin
added a commit
to costin/elasticsearch
that referenced
this pull request
Aug 11, 2021
* QL: Upgrade ANTLR and move it into QL Following elastic#76288, upgrade ANTLR library to benefit from the various improvements made in most recent releases in particular better performance and error messages. Looking at the changelog, since version 4.7.2 most changes in ANTLR seem to have occurred in non-Java targets however this commit upgrades to ANTLR 4.9.2 to benefit from the dependency updates (such as StringTemplate). Additionally move the library into QL to consolidate its use across QL projects. Relates elastic#74448 Fix elastic#76354 * Fix matching on error message Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
elasticsearchmachine
pushed a commit
that referenced
this pull request
Aug 12, 2021
* QL: Upgrade ANTLR and move it into QL Following #76288, upgrade ANTLR library to benefit from the various improvements made in most recent releases in particular better performance and error messages. Looking at the changelog, since version 4.7.2 most changes in ANTLR seem to have occurred in non-Java targets however this commit upgrades to ANTLR 4.9.2 to benefit from the dependency updates (such as StringTemplate). Additionally move the library into QL to consolidate its use across QL projects. Relates #74448 Fix #76354 * Fix matching on error message Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SPI is how plugins provide extension points for other plugins to
customize their behavior. Plugins may have a separate SPI jar, so as not
to expose the internals of the plugin implementation. In essense, this
system was built as a stopgap for Java modules, where implementation can
be protected in the same jar. However, currently the plugins service
loads both spi and plugin implementations into the same classloader.
This means that although another plugin may only compile against spi,
they could still get jar hell from a duplicate dependency.
This commit adds support for plugins to contain an "spi" subdirectory
which is loaded into a separate classloader. This spi classloader is a
parent to the plugin implementation, as well as any other plugins which
have extended it. Additionally as a demonstration of how this works in
practice, lang-painless is setup as the first plugin to provide an spi
jar, and sql's dependence on painless is changed to only spi, so that
it now has an independent version of antlr.
closes #74448