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

Replace Dropwizard with Airlift #317

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

oneonestar
Copy link
Member

@oneonestar oneonestar commented Apr 12, 2024

Description

Resolve #41

Commits cannot be built and tested individually. This is caused by the mass dependency conflict between Dropwizard and Airlift. It is impossible to replace Dropwizard part by part and keep each commit buildable. Also, it will be very difficult to review if all changes are squashed into one commit.

TODO in this PR

  • Fix docker build & health-check
  • Find out if there are better ways to handle the configuration (yaml vs .properties)
  • HTTPS support

Follow-up later in other PRs

How to run in Intellij

VM options: -Xmx1g -Djdk.attach.allowAttachSelf=true
Main class: io.trino.gateway.ha.HaGatewayLauncher
Argument: docs/quickstart-config.yaml
Working directory: $ProjectFileDir$

Release notes

(x) Release notes are required, with the following suggested text:

* Replace Dropwizard with Airlift
* (TODO) Document the incompatible changes

Comment on lines 1 to 2
node.id=ffffffff-ffff-ffff-ffff-ffffffffffff
node.environment=test
Copy link
Contributor

Choose a reason for hiding this comment

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

The gateway is not clustered, why does it need a node.id and node.environment?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's because HttpServerModule depends on NodeInfo which needs NodeConfig which requires non-null node.environment and node.id.
I should be able to set these in Java and eliminate these from the config file.
Might need to dig deeper to see if there are drawbacks of doing it.

Copy link
Member

Choose a reason for hiding this comment

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

There is no harm in having these value though .. right?

@oneonestar oneonestar force-pushed the star/airlift_try3 branch 4 times, most recently from 349c6e1 to 4c3f20a Compare April 18, 2024 07:56
@oneonestar oneonestar force-pushed the star/airlift_try3 branch 14 times, most recently from ab38025 to d2a698e Compare June 4, 2024 00:23
@oneonestar oneonestar changed the title (Preview) Replace Dropwizard with Airlift Replace Dropwizard with Airlift Jun 4, 2024
@oneonestar oneonestar marked this pull request as ready for review June 4, 2024 00:39
@Chaho12
Copy link
Member

Chaho12 commented Jun 4, 2024

I assume this is ready for PR right?

docker/Dockerfile Show resolved Hide resolved
@@ -32,6 +26,3 @@ modules:
managedApps:
- io.trino.gateway.ha.GatewayManagedApp
- io.trino.gateway.ha.clustermonitor.ActiveClusterMonitor

logging:
type: external
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Question. How is this different to httpConfig properties that you can set with https://trino.io/docs/current/admin/properties-logging.html properties using -Dconfig=var/config.properties?

Copy link
Member Author

Choose a reason for hiding this comment

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

httpConfig works the same as setting -Dconfig. There was a discussion on Slack about the pros and cons of moving from YAML to properties, mixing YAML and properties, and keeping everything in YAML. We agreed to keep everything in YAML for now.

Since we chose to use httpConfig, -Dconfig won't work. They are mutually exclusive: https://github.com/airlift/airlift/blob/538e1ff498bca145c5ec4d582692367694a94fc8/bootstrap/src/main/java/io/airlift/bootstrap/Bootstrap.java#L151-L156

@oneonestar
Copy link
Member Author

I assume this is ready for PR right?

Yes. the all-or-nothing changes are done in this PR. Reviews are welcome.
I'm still working on merging different ports into one. The changes are big and they can be tested individually. I'd like to create another PR for that.
Docs will come afterward.

@oneonestar oneonestar force-pushed the star/airlift_try3 branch 2 times, most recently from e1a0234 to 1d6fab8 Compare June 6, 2024 04:05
@oneonestar oneonestar mentioned this pull request Jun 6, 2024
2 tasks
@oneonestar oneonestar force-pushed the star/airlift_try3 branch 2 times, most recently from d0b235d to ca2e9c4 Compare June 7, 2024 04:32
Copy link
Contributor

@willmostly willmostly left a comment

Choose a reason for hiding this comment

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

This looks ready to me, mod the discussion on the UI path. Awesome work, this is massive!

@Override
public void log(Request request, Response response)
{
// Logging without filter as both request and response don't contain sensitive information
Copy link
Contributor

Choose a reason for hiding this comment

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

We should document this change for migration, as its used for debugging. I think the information is redundant with that in QueryIdCachingProxyHandler.logRewrite

Copy link
Member Author

Choose a reason for hiding this comment

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


import static jakarta.ws.rs.core.Response.Status.NOT_FOUND;

@Path("/")
Copy link
Contributor

Choose a reason for hiding this comment

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

this will prevent forwarding / to a backend correct? In some cases I forward /, and access the TGW UI on the app port. IMO we should put all the UI assets behind a prefix such as /tgw, and make the prefix configurable if possible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

Adopt airlift as base framework
4 participants