-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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 to skip loading unused plugins in Docker container #12486
Allow to skip loading unused plugins in Docker container #12486
Conversation
IFS=, read -ra names <<< "$TRINO_ENABLE_PLUGINS" | ||
for name in "${names[@]}"; do | ||
mv "$base/plugin.disabled/$name" "$base/plugin/$name" | ||
if [ -f "/etc/trino/catalog.disabled/$name.properties" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugin name != catalog name
did you mean TRINO_ENABLED_CATALOGS env var?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, you're right. I added this because there are default catalogs that will cause the server to fail at startup if the connectors/plugins they use are disabled. I want to keep this simple so I'd like to avoid adding even more env vars. Would grepping for connector.name=$name
be ok instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's another reason to only do this at build time - to avoid adding new logic to parse catalog configs outside of Java.
test_trino_starts "${CONTAINER_NAME}" "${PLATFORM}" | ||
test_trino_starts -e TRINO_ENABLE_PLUGINS=jmx,memory --platform "${PLATFORM}" "${CONTAINER_NAME}" | ||
test_trino_starts -e TRINO_DISABLE_PLUGINS=tpch,tpcds --platform "${PLATFORM}" "${CONTAINER_NAME}" | ||
test_trino_fails -e TRINO_ENABLE_PLUGINS=jmx,memory -e TRINO_DISABLE_PLUGINS=tpch,tpcds "${CONTAINER_NAME}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test_trino_fails should assert on the "exception message"
Wait for the following message log line: | ||
When Trino finishes starting up, the container will report its status as healthy. | ||
You can check it in the output of `docker ps`, or wait for the following message | ||
log line: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unrelated
I don't have strong opinions about this but IMO I don't see a lot of benefits here - the startup time isn't affected much. The only thing it might help with is satisfying security scanners which we should do the proper way. This does allow people to break things if they don't know what they are doing by for example excluding the geospatial plugin which is a dependency of Hive connector, or shared plugins like resource-group-managers/password-authenticators/teradata-functions. |
Description
Sometimes users would like to completely avoid loading unused plugins. The best recommendation would be to rebuild the Docker image, but some might struggle with this. This PR introduces two new environmental variables recognized only by the Docker container:
TRINO_ENABLE_PLUGINS
andTRINO_DISABLE_PLUGINS
, which are inclusive and exclusive comma-separated lists of plugin names. Only one of them can be non-empty.Removing plugins doesn't affect the startup time much (there's about 1s of variance):
For curiosity, I checked for
arm64
(with emulation):If adding environmental variables like this is not a good idea, maybe it's better to add some support at build time, by defining build args that would do the same. That would also be a chance to document how to build custom images based on the official Trino images.
Related issues, pull requests, and links
Documentation
( ) No documentation is needed.
( ) Sufficient documentation is included in this PR.
( ) Documentation PR is available with #prnumber.
( ) Documentation issue #issuenumber is filed, and can be handled later.
Release notes
( ) No release notes entries required.
( ) Release notes entries required with the following suggested text: