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

feat: support FlightSQL in 3.0 #24678

Merged
merged 14 commits into from
Feb 26, 2024
Merged

feat: support FlightSQL in 3.0 #24678

merged 14 commits into from
Feb 26, 2024

Conversation

hiltontj
Copy link
Contributor

@hiltontj hiltontj commented Feb 21, 2024

Closes #24643

This PR adds support for FlightSQL queries via gRPC to the influxdb3 service. It does so by ensuring the QueryExecutor implements the QueryNamespaceProvider trait, and the underlying QueryDatabase implements QueryNamespace. Satisfying those requirements allows the construction of a FlightServiceServer from the service_grpc_flight crate.

The FlightServiceServer is a gRPC server that can be served via tonic at the API surface; however, enabling this required some tower::Service wrangling. The influxdb3_server/src/server.rs module was introduced to house this code. The code there is largely inspired by this series of blog posts. The objective is to serve both gRPC (via the newly introduced tonic server) and standard REST HTTP requests (via the existing HTTP server) on the same port.

This is accomplished by the HybridService which can handle either gRPC or non-gRPC HTTP requests. The HybridService is wrapped in a HybridMakeService which allows us to serve it via hyper::Server on a single bind address.

End-to-end tests were added in influxdb3/tests/flight.rs. These cover some basic FlightSQL cases. A common.rs module was added that introduces some fixtures to aid in end-to-end tests in influxdb3.

Follow-on work

  • This PR does not implement authentication for the FlightSQL service. I have created Authorizer implementation for InfluxDB Edge #24681 to track work on that.
  • If the test fixtures added in this PR pass review, then we may consider adopting them in the other influxdb3 integration test (auth.rs)

This commit adds the ability to serve FlightSQL queries.
gRPC is served over the same address as HTTP. The Arrow Flight
service is set up, although some of the underlying traits are
not complete.
This commit brings support to the influxdb3 server to handle gRPC
requests, i.e., FlightSQL requests.

The primary server will route gRPC reqeusts to an underlying
FlightService, while other requests will still go through to the
standard REST HTTP server.

A test was added to check that it was actually working, along with
some common test helpers to spawn a server for testing.
@hiltontj hiltontj added the v3 label Feb 21, 2024
@hiltontj hiltontj self-assigned this Feb 21, 2024
@hiltontj hiltontj marked this pull request as ready for review February 23, 2024 16:28
@alamb
Copy link
Contributor

alamb commented Feb 26, 2024

The objective is to serve both gRPC (via the newly introduced tonic server) and standard REST HTTP requests (via the existing HTTP server) on the same port.

👏 this was never something I was able to figure out when implementing the services in influxdb_iox

Copy link
Contributor

@mgattozzi mgattozzi left a comment

Choose a reason for hiding this comment

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

This is great. I have nothing to say here besides great job. It's wild to see it "Just Work™" and over the same port as well. Kudos. I'm just going to approve this cause I wouldn't change anything myself.

@hiltontj hiltontj merged commit 298055e into main Feb 26, 2024
13 checks passed
@hiltontj hiltontj deleted the hiltontj/flight-sql branch February 26, 2024 20:07
@hiltontj
Copy link
Contributor Author

Created #24695 to come back and add some documentation.

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

Successfully merging this pull request may close these issues.

Wire up FlightSQL
3 participants