-
Notifications
You must be signed in to change notification settings - Fork 4.1k
GH-49661: [CI][C++] Suppress deprecated warnings with gRPC 1.80.0 #49662
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -732,19 +732,31 @@ class GrpcClientImpl : public internal::ClientTransport { | |
| # endif // defined(GRPC_USE_CERTIFICATE_VERIFIER) | ||
|
|
||
| # if defined(GRPC_USE_TLS_CHANNEL_CREDENTIALS_OPTIONS) | ||
| # if GRPC_CPP_VERSION_CHECK(1, 80, 0) | ||
| auto certificate_provider = | ||
| std::make_shared<::grpc::experimental::InMemoryCertificateProvider>(); | ||
| RETURN_NOT_OK(FromAbslStatus(certificate_provider->UpdateRoot(kDummyRootCert))); | ||
| # else | ||
| auto certificate_provider = | ||
| std::make_shared<::grpc::experimental::StaticDataCertificateProvider>( | ||
| kDummyRootCert); | ||
|
Comment on lines
+735
to
742
|
||
| # endif | ||
| # if defined(GRPC_USE_TLS_CHANNEL_CREDENTIALS_OPTIONS_ROOT_CERTS) | ||
| ::grpc::experimental::TlsChannelCredentialsOptions tls_options( | ||
| certificate_provider); | ||
| # else // defined(GRPC_USE_TLS_CHANNEL_CREDENTIALS_OPTIONS_ROOT_CERTS) | ||
| // While gRPC >= 1.36 does not require a root cert (it has a default) | ||
| // in practice the path it hardcodes is broken. See grpc/grpc#21655. | ||
| # else // defined(GRPC_USE_TLS_CHANNEL_CREDENTIALS_OPTIONS_ROOT_CERTS) | ||
| // While gRPC >= 1.36 does not require a root cert (it has a default) | ||
| // in practice the path it hardcodes is broken. See grpc/grpc#21655. | ||
| ::grpc::experimental::TlsChannelCredentialsOptions tls_options; | ||
| # if GRPC_CPP_VERSION_CHECK(1, 80, 0) | ||
| tls_options.set_root_certificate_provider(certificate_provider); | ||
| # else | ||
| tls_options.set_certificate_provider(certificate_provider); | ||
| # endif | ||
| # endif // defined(GRPC_USE_TLS_CHANNEL_CREDENTIALS_OPTIONS_ROOT_CERTS) | ||
| # if !GRPC_CPP_VERSION_CHECK(1, 80, 0) | ||
| tls_options.watch_root_certs(); | ||
| # endif | ||
| tls_options.set_root_cert_name("dummy"); | ||
| # if defined(GRPC_USE_CERTIFICATE_VERIFIER) | ||
| tls_options.set_certificate_verifier(std::move(cert_verifier)); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -331,6 +331,49 @@ ::grpc::Status ToGrpcStatus(const Status& arrow_status, ::grpc::ServerContext* c | |
| return status; | ||
| } | ||
|
|
||
| #if GRPC_CPP_VERSION_CHECK(1, 80, 0) | ||
| Status FromAbslStatus(const ::absl::Status& absl_status) { | ||
| switch (absl_status.code()) { | ||
| case ::absl::StatusCode::kOk: | ||
| return Status::OK(); | ||
| case ::absl::StatusCode::kCancelled: | ||
| return Status::Cancelled(absl_status.ToString()); | ||
| case ::absl::StatusCode::kUnknown: | ||
| return Status::UnknownError(absl_status.ToString()); | ||
| case ::absl::StatusCode::kInvalidArgument: | ||
| return Status::Invalid(absl_status.ToString()); | ||
| case ::absl::StatusCode::kDeadlineExceeded: | ||
| return Status::IOError(absl_status.ToString()); | ||
| case ::absl::StatusCode::kNotFound: | ||
| return Status::KeyError(absl_status.ToString()); | ||
| case ::absl::StatusCode::kAlreadyExists: | ||
| return Status::AlreadyExists(absl_status.ToString()); | ||
| case ::absl::StatusCode::kPermissionDenied: | ||
| return Status::IOError(absl_status.ToString()); | ||
| case ::absl::StatusCode::kResourceExhausted: | ||
| return Status::IOError(absl_status.ToString()); | ||
| case ::absl::StatusCode::kFailedPrecondition: | ||
| return Status::IOError(absl_status.ToString()); | ||
| case ::absl::StatusCode::kAborted: | ||
| return Status::IOError(absl_status.ToString()); | ||
| case ::absl::StatusCode::kOutOfRange: | ||
| return Status::Invalid(absl_status.ToString()); | ||
| case ::absl::StatusCode::kUnimplemented: | ||
| return Status::NotImplemented(absl_status.ToString()); | ||
| case ::absl::StatusCode::kInternal: | ||
| return Status::IOError(absl_status.ToString()); | ||
| case ::absl::StatusCode::kUnavailable: | ||
| return Status::IOError(absl_status.ToString()); | ||
| case ::absl::StatusCode::kDataLoss: | ||
| return Status::IOError(absl_status.ToString()); | ||
| case ::absl::StatusCode::kUnauthenticated: | ||
| return Status::IOError(absl_status.ToString()); | ||
| default: | ||
| return Status::UnknownError(absl_status.ToString()); | ||
| } | ||
|
Comment on lines
+334
to
+373
|
||
| } | ||
| #endif | ||
|
|
||
| } // namespace grpc | ||
| } // namespace transport | ||
| } // namespace flight | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,6 +34,12 @@ class Status; | |
|
|
||
| namespace flight { | ||
|
|
||
| #define GRPC_CPP_VERSION_CHECK(major, minor, patch) \ | ||
| ((GRPC_CPP_VERSION_MAJOR > (major) || \ | ||
| (GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR > (minor)) || \ | ||
| ((GRPC_CPP_VERSION_MAJOR == (major) && GRPC_CPP_VERSION_MINOR == (minor) && \ | ||
| GRPC_CPP_VERSION_PATCH >= (patch))))) | ||
|
Comment on lines
+37
to
+41
|
||
|
|
||
| #define GRPC_RETURN_NOT_OK(expr) \ | ||
| do { \ | ||
| ::arrow::Status _s = (expr); \ | ||
|
|
@@ -90,6 +96,12 @@ ARROW_FLIGHT_EXPORT | |
| ::grpc::Status ToGrpcStatus(const Status& arrow_status, | ||
| ::grpc::ServerContext* ctx = nullptr); | ||
|
|
||
| // gRPC 1.80.0 or later use absl::Status. | ||
| #if GRPC_CPP_VERSION_CHECK(1, 80, 0) | ||
| /// Convert an Abseil status to an Arrow status. | ||
| ARROW_FLIGHT_EXPORT | ||
| Status FromAbslStatus(const ::absl::Status& absl_status); | ||
| #endif | ||
|
Comment on lines
+99
to
+104
|
||
| } // namespace grpc | ||
| } // namespace transport | ||
| } // namespace flight | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code calls
FromAbslStatus(...), butFromAbslStatusis only declared whenABSL_NAMESPACE_BEGINis defined. Please either (1) ensure Abseil status headers are included so the symbol is always available in this build configuration, or (2) guard this call with the same preprocessor condition to avoid compilation failures in builds where Abseil isn’t present/used.