Skip to content

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

Merged
lidavidm merged 4 commits into
apache:mainfrom
lidavidm:flight-async-cpp-client-getflightinfo
Aug 9, 2023
Merged

lidavidm merged 4 commits into
apache:mainfrom
lidavidm:flight-async-cpp-client-getflightinfo

Conversation

@lidavidm

@lidavidm lidavidm commented Jul 6, 2023 •

Copy link
Copy Markdown
Member

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

lidavidm commented Jul 6, 2023

Copy link
Copy Markdown
Member Author

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

lidavidm commented Jul 7, 2023

Copy link
Copy Markdown
Member Author

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

Comment thread cpp/src/arrow/flight/types.cc Resolved
Comment thread cpp/src/arrow/flight/client.cc Resolved

@kou kou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

+1

Comment thread cpp/src/arrow/flight/client.cc Resolved
Comment thread cpp/src/arrow/flight/types.h Resolved
@lidavidm
lidavidm force-pushed the flight-async-cpp-client-getflightinfo branch from d842802 to b2c4774 Compare July 14, 2023 18:10
Comment thread cpp/src/arrow/flight/types.h Resolved
Comment thread cpp/src/arrow/flight/client.h Resolved
Comment thread cpp/src/arrow/flight/flight_test.cc Resolved
Comment thread cpp/src/arrow/flight/flight_test.cc Resolved
Comment thread cpp/src/arrow/flight/client.h Resolved
Comment thread cpp/src/arrow/flight/types_async.h Resolved
Comment thread cpp/src/arrow/flight/transport.h Resolved
@lidavidm

lidavidm commented Jul 17, 2023 •

Copy link
Copy Markdown
Member Author

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
Copy Markdown
Member Author

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

@lidavidm

lidavidm commented Aug 7, 2023

Copy link
Copy Markdown
Member Author

This has been ready for review for about 2 weeks.

@lidavidm

lidavidm commented Aug 7, 2023

Copy link
Copy Markdown
Member Author

It looks like another commit introduced clang-format errors.

@kou

kou commented Aug 8, 2023

Copy link
Copy Markdown
Member

Sorry. #37048 fixed the lint error.

@kou kou left a comment

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
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
Copy Markdown
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

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

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.

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@lidavidm
lidavidm force-pushed the flight-async-cpp-client-getflightinfo branch from df885ea to e2738ac Compare August 8, 2023 14:27

@pitrou pitrou left a comment

Copy link
Copy Markdown
Member

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
@lidavidm
lidavidm deleted the flight-async-cpp-client-getflightinfo branch August 9, 2023 15:02
@kou

kou commented Aug 10, 2023

Copy link
Copy Markdown
Member

@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
Copy Markdown
Member Author

#37099

@conbench-apache-arrow

Copy link
Copy Markdown

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