Skip to content

Handle providers of optional services in ubermodule classloader #91217

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

Merged
merged 9 commits into from
Nov 15, 2022

Conversation

williamrandolph
Copy link
Contributor

It is possible for a service provider to implement a service defined in optional (compile-time) dependency. When creating an ubermodule, we need to make sure that we do not declare a service if its optional dependency is missing at run-time, because if we try to do this we get a failure at the module graph construction stage. To do this, we make sure that the service class or interface is part of an exported package that the ubermodule can read.

ubermodule descriptor, we must make sure that any optional
dependencies match up to services that are defined in the
code. If we naively declare that our module uses any service
that is implemented by one of its jars, we might fail to load
the plugin because the original implementation is not included
in our bundle.

Here we add a fairly detailed test scenario for required and
optional services defined outside the bundle, as well as for
services defined within the bundle, either by module declaration
or by META-INF/services entry.
@williamrandolph williamrandolph added the test-windows Trigger CI checks on Windows label Oct 31, 2022
@williamrandolph
Copy link
Contributor Author

@elasticmachine test this please

@williamrandolph williamrandolph added >non-issue :Core/Infra/Plugins Plugin API and infrastructure labels Oct 31, 2022
declaring that the ubermodule owns packages for missing optional
dependencies, just don't add services from missing optional
dependencies or their providers to the ubermodule declaration.
@williamrandolph williamrandolph marked this pull request as ready for review November 2, 2022 20:24
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Nov 2, 2022
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Contributor

@ChrisHegarty ChrisHegarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@williamrandolph williamrandolph merged commit e144722 into elastic:main Nov 15, 2022
weizijun added a commit to weizijun/elasticsearch that referenced this pull request Nov 15, 2022
* main: (163 commits)
  [DOCS] Edits frequent items aggregation (elastic#91564)
  Handle providers of optional services in ubermodule classloader (elastic#91217)
  Add `exportDockerImages` lifecycle task for exporting docker tarballs (elastic#91571)
  Fix CSV dependency report output file location in DRA CI job
  Fix variable placeholder for Strings.format calls (elastic#91531)
  Fix output dir creation in ConcatFileTask (elastic#91568)
  Fix declaration of dependencies in DRA snapshots CI job (elastic#91569)
  Upgrade Gradle Enterprise plugin to 3.11.4 (elastic#91435)
  Ingest DateProcessor (small) speedup, optimize collections code in DateFormatter.forPattern (elastic#91521)
  Fix inter project handling of generateDependenciesReport (elastic#91555)
  [Synthetics] Add synthetics-* read to fleet-server (elastic#91391)
  [ML] Copy more settings when creating DF analytics destination index (elastic#91546)
  Reduce CartesianCentroidIT flakiness (elastic#91553)
  Propagate last node to reinitialized routing tables (elastic#91549)
  Forecast write load during rollovers (elastic#91425)
  [DOCS] Warn about potential overhead of named queries (elastic#91512)
  Datastream unavailable exception metadata (elastic#91461)
  Generate docker images and dependency report in DRA ci job (elastic#91545)
  Support cartesian_bounds aggregation on point and shape (elastic#91298)
  Add support for EQL samples queries (elastic#91312)
  ...

# Conflicts:
#	x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/downsample/RollupShardIndexer.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Core/Infra/Plugins Plugin API and infrastructure >non-issue Team:Core/Infra Meta label for core/infra team test-windows Trigger CI checks on Windows v8.6.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants