Painless: Modify Loader to Load Classes Directly from Definition#28088
Merged
jdconrad merged 6 commits intoelastic:masterfrom Jan 5, 2018
Merged
Painless: Modify Loader to Load Classes Directly from Definition#28088jdconrad merged 6 commits intoelastic:masterfrom
jdconrad merged 6 commits intoelastic:masterfrom
Conversation
Contributor
Author
|
@elasticmachine Please test this. |
rjernst
approved these changes
Jan 5, 2018
| for (ScriptContext<?> context : contexts) { | ||
| if (context.instanceClazz.equals(SearchScript.class) || context.instanceClazz.equals(ExecutableScript.class)) { | ||
| contextsToCompilers.put(context, new Compiler(GenericElasticsearchScript.class, Definition.DEFINITION)); | ||
| contextsToCompilers.put(context, new Compiler(GenericElasticsearchScript.class, new Definition( |
Member
There was a problem hiding this comment.
For now, let's move the construction of Definition out of the loop, so we still only create one, until we can figure out if we need an internal cache to ensure too many copies aren't loaded of common classes.
Contributor
Author
There was a problem hiding this comment.
Agreed. Changed this to re-use the same Definition for all contexts for now.
Contributor
Author
|
@rjernst Thanks for the review. Will push as soon as the CI completes successfully. |
jasontedor
added a commit
to jasontedor/elasticsearch
that referenced
this pull request
Jan 6, 2018
* master: (25 commits) Remove Gradle cheatsheet Fix reproduction info to point to Gradle wrapper Update platforms tests to use Gradle wrapper Update testing docs to reflect Gradle wrapper Painless: Modify Loader to Load Classes Directly from Definition (elastic#28088) Update contributing docs to use the Gradle wrapper Create nio-transport plugin for NioTransport (elastic#27949) test: replaced try-catch statements with expectThrows(...) Add getWarmer and getTranslog method to NodeIndicesStats (elastic#28092) fix doc mistake Added ASN support for Ingest GeoIP plugin. Fix global aggregation that requires breadth first and scores (elastic#27942) Introduce Gradle wrapper Ignore GIT_COMMIT when calculating commit hash Re-enable bwc tests after elastic#27881 was backported Set the elasticsearch-nio codebase for tests (elastic#28067) Bump compat version for local depdendent test to 6.2.0 Pass `java.locale.providers=COMPAT` to Java 9 onwards (elastic#28080) Allow shrinking of indices from a previous major (elastic#28076) Remove deprecated exceptions (elastic#28059) ...
jasontedor
added a commit
to jasontedor/elasticsearch
that referenced
this pull request
Jan 6, 2018
* master: Remove Gradle cheatsheet Fix reproduction info to point to Gradle wrapper Update platforms tests to use Gradle wrapper Update testing docs to reflect Gradle wrapper Painless: Modify Loader to Load Classes Directly from Definition (elastic#28088) Update contributing docs to use the Gradle wrapper Create nio-transport plugin for NioTransport (elastic#27949)
jasontedor
added a commit
that referenced
this pull request
Jan 6, 2018
* master: Remove out-of-date projectile file Remove Gradle cheatsheet Fix reproduction info to point to Gradle wrapper Update platforms tests to use Gradle wrapper Update testing docs to reflect Gradle wrapper Painless: Modify Loader to Load Classes Directly from Definition (#28088) Update contributing docs to use the Gradle wrapper Create nio-transport plugin for NioTransport (#27949) test: replaced try-catch statements with expectThrows(...) Add getWarmer and getTranslog method to NodeIndicesStats (#28092) fix doc mistake Added ASN support for Ingest GeoIP plugin. Fix global aggregation that requires breadth first and scores (#27942)
jdconrad
added a commit
that referenced
this pull request
Jan 9, 2018
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.
Updated the Painless Loader to first look for classes that are already loaded as part of the Definition initialization through the Whitelist. This allows for modules/plugins to whitelist custom classes without forcing Painless to have a direct relationship with the module's/plugin's ClassLoader.
This also removes the singleton of Definition, so now there will be one Definition per Compiler. However, the standard whitelist files singleton still exists out of convenience for now for testing. This should be cleaned up later in a different PR.
@rjernst This will be difficult to properly test until we integrate directly with SPI.