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

GH-36512: [C++][FlightRPC] Add async GetFlightInfo client call #36517

Merged

Conversation

lidavidm
Copy link
Member

@lidavidm lidavidm commented Jul 6, 2023

Rationale for this change

Async is a long-requested feature.

What changes are included in this PR?

Just the C++ implementation of async GetFlightInfo for the client.

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes, new APIs.

@lidavidm
Copy link
Member Author

lidavidm commented Jul 6, 2023

Assuming the interface is roughly OK, I'd like to add basic Python bindings in the next PR (to make sure this interface adapts properly to asyncio/AnyIO)

@lidavidm
Copy link
Member Author

lidavidm commented Jul 7, 2023

Ah, I always forget the windows export macros...

cpp/src/arrow/flight/types.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/client.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/transport/grpc/grpc_client.cc Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Jul 14, 2023
Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

cpp/src/arrow/flight/client.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/test_definitions.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/test_definitions.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/transport/grpc/grpc_client.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/transport/grpc/grpc_client.cc Outdated Show resolved Hide resolved
@lidavidm lidavidm force-pushed the flight-async-cpp-client-getflightinfo branch from d842802 to b2c4774 Compare July 14, 2023 18:10
@github-actions github-actions bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Jul 14, 2023
cpp/src/arrow/flight/flight_test.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/flight_test.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/client.h Outdated Show resolved Hide resolved
cpp/src/arrow/flight/serialization_internal.h Show resolved Hide resolved
cpp/src/arrow/flight/types_async.h Show resolved Hide resolved
cpp/src/arrow/flight/transport.h Outdated Show resolved Hide resolved
cpp/src/arrow/flight/transport/grpc/grpc_client.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/transport/grpc/grpc_client.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/transport/grpc/grpc_client.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/transport/grpc/util_internal.cc Outdated Show resolved Hide resolved
@github-actions github-actions bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Jul 17, 2023
@lidavidm
Copy link
Member Author

lidavidm commented Jul 17, 2023

TODOs:

  • Use Status instead of TransportStatus, add TransportStatusDetail
  • Replicate the crash and see if we can avoid it via a background destructor thread
  • Add overload to directly return a Future<FlightInfo> (and use that for convenience in tests)
  • Start looking into HTTP status codes as the canonical status codes (incl. how they play out with gRPC) (separate task)
  • It seems some versions of gRPC we build with don't support async yet, may have to ifdef things out (though, I need to rebase this again I think)
  • Debug MinGW

@lidavidm
Copy link
Member Author

Ah, it may be experimental before v1.40... grpc/grpc@3e19bab

@lidavidm
Copy link
Member Author

lidavidm commented Aug 7, 2023

This has been ready for review for about 2 weeks.

@lidavidm
Copy link
Member Author

lidavidm commented Aug 7, 2023

It looks like another commit introduced clang-format errors.

@kou
Copy link
Member

kou commented Aug 8, 2023

Sorry. #37048 fixed the lint error.

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

Can we merge this because this is still an experimental API?
If we found a problem with this API later, we can fix it in follow-up tasks.

@@ -742,5 +740,7 @@ TEST(TransportErrorHandling, ReconstructStatus) {
ASSERT_EQ(detail->extra_info(), "Binary error details");
}

// TODO: test TransportStatusDetail
Copy link
Member

Choose a reason for hiding this comment

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

Should we resolve this TODO in this PR or can we defer to a follow-up PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd rather follow up in a separate PR since it appears the PR is already too large to get reviews

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Aug 8, 2023
Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, I was away. A couple of comments below but overall I agree it is good to go.

cpp/src/arrow/flight/test_definitions.cc Show resolved Hide resolved
cpp/src/arrow/flight/test_definitions.cc Outdated Show resolved Hide resolved

ASSERT_FINISHES_OK(future);
}

Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to add a test that 1) starts a long-running async operation 2) closes the client 3) checks the Future is well-behaved (perhaps it returns Status::Cancelled?).

Perhaps in another PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

We cannot handle closing the client, as explained in the comment below - something has to own the resources at some point that isn't the Future itself.

Copy link
Member

Choose a reason for hiding this comment

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

Fair enough, but I'll note that this sort of situation will come up easily in Python.

cpp/src/arrow/flight/test_definitions.cc Outdated Show resolved Hide resolved
cpp/src/arrow/flight/transport/grpc/grpc_client.cc Outdated Show resolved Hide resolved
@lidavidm lidavidm force-pushed the flight-async-cpp-client-getflightinfo branch from df885ea to e2738ac Compare August 8, 2023 14:27
@github-actions github-actions bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Aug 8, 2023
@github-actions github-actions bot added awaiting change review Awaiting change review awaiting changes Awaiting changes and removed awaiting changes Awaiting changes awaiting change review Awaiting change review labels Aug 8, 2023
@lidavidm lidavidm requested a review from pitrou August 9, 2023 14:15
Copy link
Member

@pitrou pitrou left a comment

Choose a reason for hiding this comment

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

+1, let's go with this as this is already a nice addition.

@lidavidm lidavidm merged commit 9f183fc into apache:main Aug 9, 2023
35 of 36 checks passed
@lidavidm lidavidm removed the awaiting changes Awaiting changes label Aug 9, 2023
@lidavidm lidavidm deleted the flight-async-cpp-client-getflightinfo branch August 9, 2023 15:02
@kou
Copy link
Member

kou commented Aug 10, 2023

@lidavidm Could you update cpp/src/arrow/flight/transport/ucx/ucx_internal.cc as a follow-up task? It still uses internal::TransportStatusCode.

@lidavidm
Copy link
Member Author

#37099

@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit 9f183fc.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details. It also includes information about possible false positives for unstable benchmarks that are known to sometimes produce them.

loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
…pache#36517)

### Rationale for this change

Async is a long-requested feature.

### What changes are included in this PR?

Just the C++ implementation of async GetFlightInfo for the client.

### Are these changes tested?

Yes.

### Are there any user-facing changes?

Yes, new APIs.

* Closes: apache#36512

Authored-by: David Li <[email protected]>
Signed-off-by: David Li <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[C++][FlightRPC] Async Flight: GetFlightInfo implementation
4 participants