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

(Preview) Replace Dropwizard with Airlift #317

Draft
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

oneonestar
Copy link
Member

@oneonestar oneonestar commented Apr 12, 2024

Description

Resolve #41

The first two commits will be split into different PR.
The following commits can no longer 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
  • Update docs on how to config & run
  • Document the incompatible changes and provide a migration guide.
  • Find out if there are better ways to handle the configuration (yaml vs .properties)
  • HTTPS support

Follow-up later in other PRs

  • Refactor and make the use of dependency injection consistent

How to run in Intellij

VM options: -Xmx1g -Djdk.attach.allowAttachSelf=true -Dlog.levels-file=gateway-ha/etc/log.properties -Dconfig=gateway-ha/etc/config.properties
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 2 times, most recently from d986394 to 349c6e1 Compare April 18, 2024 06:52
// public Module constructor(HaGatewayConfiguration)
// public Module constructor(HaGatewayConfiguration, Environment)
Constructor<?>[] constructors = Class.forName(clazz).getConstructors();
if (constructors.length != 1) {
throw new RuntimeException(format("Failed to load module [%s]. Multiple constructors exist.", clazz));
}
Constructor<?> constructor = constructors[0];
Object module = switch (constructor.getParameterCount()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

could replace this switch with an if

@@ -20,6 +20,7 @@

public class HaGatewayConfiguration
{
private Map<String, String> airliftConfig = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

airliftConfig may not be intuitive to users unfamiliar with the implementation details. If we set node.environment in the code, then something like httpConfig would be more obvious

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
3 participants