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 DevelopmentServer testing with internal and external plugins together #23100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xkrogen
Copy link
Member

@xkrogen xkrogen commented Aug 21, 2024

Description

This PR makes it possible to use the local DevelopmentServer with both "internal" plugins (those within the trino repo) as well as "external" plugins that originate from outside of the repository. A new HybridDevelopmentPluginsProvider is added which loads plugins both from plugin.dir and from plugin.bundles, and this is now used by default in DevelopmentServer. No additional plugins are loaded by default, but any plugin directories dropped into testing/trino-server-dev/etc/plugin will be picked up automatically.

For now this is added as an entirely new PluginsProvider which combines the behavior of the development and server plugins providers, but I would also be happy to structure it such that DevelopmentPluginsProvider just does this internally (by delegating to ServerPluginsProvider). Feedback is welcomed.

Additional context and related issues

In #6834, the whole dev server was refactored. Previously, it was possible to use plugin.dir as well as plugin.bundles simultaneously, but after the refactor, these were moved to two separate plugin loaders (ServerPluginsProvider and DevelopmentPluginsProviders, respectively). DevelopmentServer only uses DevelopmentPluginsProvider, so it can load plugins from POM, but cannot load plugins from a directory, making it challenging to leverage the DevelopmentServer to test other plugins. This can be really useful while working on third party plugins that live outside of the Trino repo, and in particular, to test interactions between plugins, such as redirection, or inspecting the events received by a third-party event listener when working with an internal catalog.

Release notes

(X) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text:

@cla-bot cla-bot bot added the cla-signed label Aug 21, 2024
@xkrogen
Copy link
Member Author

xkrogen commented Aug 21, 2024

cc @findepi @electrum

Copy link

This pull request has gone a while without any activity. Tagging the Trino developer relations team: @bitsondatadev @colebow @mosabua

@github-actions github-actions bot added the stale label Sep 19, 2024
Copy link

Closing this pull request, as it has been stale for six weeks. Feel free to re-open at any time.

@github-actions github-actions bot closed this Oct 11, 2024
@mosabua mosabua reopened this Oct 11, 2024
@mosabua
Copy link
Member

mosabua commented Oct 11, 2024

I think this would be a great feature to add for developers. Reopened and added staleignore. I will try to review and help towards merge.

@mosabua mosabua added stale-ignore Use this label on PRs that should be ignored by the stale bot so they are not flagged or closed. and removed stale labels Oct 11, 2024
@xkrogen xkrogen force-pushed the xkrogen/hybrid-development-plugins-provider branch from 23a0e5c to 903aaff Compare October 11, 2024 21:00
@xkrogen
Copy link
Member Author

xkrogen commented Oct 11, 2024

Rebased! Should be ready for review again :)

Copy link
Member

@mosabua mosabua left a comment

Choose a reason for hiding this comment

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

Minor nits only. Looks pretty close to ready. Any thoughts about configuration and semantics of it all @electrum @martint

testing/trino-server-dev/etc/plugin/README.md Outdated Show resolved Hide resolved
testing/trino-server-dev/etc/plugin/README.md Outdated Show resolved Hide resolved
testing/trino-server-dev/etc/plugin/README.md Outdated Show resolved Hide resolved
@xkrogen xkrogen force-pushed the xkrogen/hybrid-development-plugins-provider branch from 629b15e to 2c30807 Compare October 16, 2024 22:32
README.md Outdated Show resolved Hide resolved
@mosabua
Copy link
Member

mosabua commented Oct 23, 2024

Code looks good to me. Just need to get docs updated and do some testing. Anybody else wants to chime in about their testing of this or other aspects @nineinchnick @martint @electrum ?

@xkrogen xkrogen force-pushed the xkrogen/hybrid-development-plugins-provider branch from 85f200a to 8379005 Compare November 4, 2024 17:55
@mosabua
Copy link
Member

mosabua commented Nov 4, 2024

Can you squash commits @xkrogen ?

@xkrogen xkrogen force-pushed the xkrogen/hybrid-development-plugins-provider branch from 8379005 to b1e718d Compare November 4, 2024 19:15
@xkrogen
Copy link
Member Author

xkrogen commented Nov 4, 2024

Can you squash commits @xkrogen ?

I thought the point of the fixup! commits are that the squash will be done automatically as part of the merge? (I was following point #6 here.)

Anyway I have squashed, just want to better understand this for next time.

@@ -34,3 +34,7 @@ product-test-reports
**/dependency-reduced-pom.xml
core/trino-web-ui/src/main/resources/webapp/dist/
.node

# Local plugins added for testing should be excluded
testing/trino-server-dev/etc/plugin/*
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this redundant with testing/trino-server-dev/etc/plugin/.gitignore?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes! This was added before I added the nested .gitignore. Thanks for catching it.

@Override
public void loadPlugins(Loader loader, ClassLoaderFactory createClassLoader)
{
developmentPluginsProvider.loadPlugins(loader, createClassLoader);
Copy link
Member

Choose a reason for hiding this comment

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

This looks ok to me, but I wonder if we can improve the developer experience here. Coping plugins is one extra step that could be avoided - if the DevelopmentPluginsProvider was able to load a plugin from a directory, then we could add directories to the plugin.bundles list.

Copy link
Member Author

@xkrogen xkrogen Nov 5, 2024

Choose a reason for hiding this comment

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

Hm I see what you're saying. Currently, plugins.bundle supports pom.xml/*.pom files as well as Maven coordinates, and we could also add support for directories. It's a good idea! I can take a look at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed stale-ignore Use this label on PRs that should be ignored by the stale bot so they are not flagged or closed.
Development

Successfully merging this pull request may close these issues.

3 participants