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

Support of classrealms and new plugin structure #13930

Merged
merged 29 commits into from
Sep 18, 2024

Conversation

rfscholte
Copy link
Contributor

@rfscholte rfscholte commented Sep 3, 2024

With classrealms there will be much more control over the classloaders.
Next to the shaded plugins, a plugin-directory may contain a pinot-plugin.properties (to switch from PluginClassloader to ClassRealms).

if there is no pinot-plugin.properties, the original behavior is used.
if there is a pinot-plugin.properties, a classrealm will be created: every direct file or directory in the plugin-directory will be added to the classrealm.

It is possible to let shaded plugins use a classrealm. In that case the classes in the shaded jar will be loaded before the system classloader (as done by the PluginLoader).

this implementation doesn't unpack plugin-zips as created with the assembly descriptor. Instead is assumes it is unpacked before pinot starts.

…here should be different configuration for this instance
…ot you'll have "unlimited" mode, all classes will be looked up in the pinot-realm first.
Make pinot-plugin.properties required (as it is a markerfile to switch to classrealms)
@codecov-commenter
Copy link

codecov-commenter commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 70.93023% with 25 lines in your changes missing coverage. Please review.

Project coverage is 57.98%. Comparing base (59551e4) to head (84ab856).
Report is 1018 commits behind head on master.

Files with missing lines Patch % Lines
...ava/org/apache/pinot/spi/plugin/PluginManager.java 70.83% 21 Missing ⚠️
...che/pinot/spi/plugin/PinotPluginConfiguration.java 71.42% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #13930      +/-   ##
============================================
- Coverage     61.75%   57.98%   -3.77%     
- Complexity      207      219      +12     
============================================
  Files          2436     2613     +177     
  Lines        133233   143275   +10042     
  Branches      20636    21992    +1356     
============================================
+ Hits          82274    83084     +810     
- Misses        44911    53700    +8789     
- Partials       6048     6491     +443     
Flag Coverage Δ
custom-integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration <0.01% <0.00%> (-0.01%) ⬇️
integration1 <0.01% <0.00%> (-0.01%) ⬇️
integration2 0.00% <0.00%> (ø)
java-11 57.92% <70.93%> (-3.79%) ⬇️
java-21 57.83% <70.93%> (-3.79%) ⬇️
skip-bytebuffers-false 57.95% <70.93%> (-3.79%) ⬇️
skip-bytebuffers-true 57.80% <70.93%> (+30.07%) ⬆️
temurin 57.98% <70.93%> (-3.77%) ⬇️
unittests 57.98% <70.93%> (-3.77%) ⬇️
unittests1 40.82% <70.93%> (-6.07%) ⬇️
unittests2 27.98% <0.00%> (+0.25%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@rfscholte rfscholte mentioned this pull request Sep 3, 2024
@gortiz gortiz added release-notes Referenced by PRs that need attention when compiling the next release notes plugins labels Sep 3, 2024
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.7.1</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't need to pin version for this plugin

pinot-spi/pom.xml Show resolved Hide resolved
pinot-spi/pom.xml Show resolved Hide resolved
@gortiz gortiz merged commit 3aab305 into apache:master Sep 18, 2024
23 checks passed
Comment on lines +48 to +62
private final Path _pluginsDirectory = Path.of("target/test-classes/plugins").toAbsolutePath();

// MathUtils is only used in pinot framework, should not be available in limited plugins
private final String _commonsMathUtils = "org.apache.commons.math3.util.MathUtils";

// IOUtils exists in all realms, they should use their own version
private final String _commonsIOUtils = "org.apache.commons.io.IOUtils";

// TimeUtils exists in all realms, they should be imported from pinot classloader
private final String _spiTimeUtils = "org.apache.pinot.spi.utils.TimeUtils";

public final String _yammerMetricsRegistry = "org.apache.pinot.plugin.metrics.yammer.YammerMetricsRegistry";

public final String _dropwizardMetricsRegistry =
"org.apache.pinot.plugin.metrics.dropwizard.DropwizardMetricsRegistry";
Copy link
Contributor

Choose a reason for hiding this comment

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

These can be constants (i.e. static final)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this has already been merged, so I'll leave this up to you

@rfscholte rfscholte deleted the STP-3362_classrealms branch September 19, 2024 09:28
@Jackie-Jiang
Copy link
Contributor

This is causing failure when releasing with commend: mvn install -Papache-release -ntp with exception: java.nio.file.NoSuchFileException: /Users/jackie/Projects/pinot/pinot-plugins/target/classes/pinot-plugin.properties

@rfscholte @gortiz Do you know how to fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugins release-notes Referenced by PRs that need attention when compiling the next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants