Skip to content

Conversation

@kewang1024
Copy link
Collaborator

@kewang1024 kewang1024 commented Oct 26, 2025

== RELEASE NOTES ==

General Changes
* Add http2 support for HTTP client

@kewang1024 kewang1024 requested review from a team as code owners October 26, 2025 05:57
@prestodb-ci prestodb-ci added the from:Meta PR from Meta label Oct 26, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Oct 26, 2025

Reviewer's Guide

This PR integrates HTTP/2 support into the exchange client by adding a toggleable configuration flag and updating the SSL context, request builders, and data processing to respect this flag.

Sequence diagram for HTTP/2 protocol selection during SSL context creation

sequenceDiagram
participant Utils_createSSLContext
participant SystemConfig
participant SSLContext
Utils_createSSLContext->>SystemConfig: exchangeHttp2Enabled()
alt HTTP/2 enabled
  Utils_createSSLContext->>SSLContext: setAdvertisedNextProtocols(["h2", "http/1.1"])
else HTTP/2 disabled
  Utils_createSSLContext->>SSLContext: setAdvertisedNextProtocols(["http/1.1"])
end
Loading

Sequence diagram for HTTP version selection in RequestBuilder

sequenceDiagram
participant "RequestBuilder()"
participant "SystemConfig"
alt HTTP/2 disabled
  "RequestBuilder()"->>"SystemConfig": exchangeHttp2Enabled()
  "RequestBuilder()"->>"headers_": setHTTPVersion(1, 1)
else HTTP/2 enabled
  "RequestBuilder()"->>"SystemConfig": exchangeHttp2Enabled()
  Note over "RequestBuilder()": Do not set HTTP version explicitly
end
Loading

Class diagram for updated SystemConfig with HTTP/2 support

classDiagram
class SystemConfig {
  +bool exchangeHttp2Enabled() const
  +static constexpr std::string_view kExchangeHttp2Enabled
}
SystemConfig : ConfigBase
Loading

Class diagram for updated RequestBuilder respecting HTTP/2 config

classDiagram
class RequestBuilder {
  +RequestBuilder()
  -headers_
}
RequestBuilder --> SystemConfig: uses
Loading

Class diagram for updated SSLContext creation with HTTP/2 support

classDiagram
class SSLContext {
  +setAdvertisedNextProtocols(protocols)
}
class Utils {
  +createSSLContext()
}
Utils --> SSLContext: creates/sets protocols
Utils --> SystemConfig: checks exchangeHttp2Enabled
Loading

File-Level Changes

Change Details Files
Introduce a new configuration flag for HTTP/2 in SystemConfig
  • Declare kExchangeHttp2Enabled in Configs.h
  • Implement exchangeHttp2Enabled() getter
  • Register BOOL_PROP defaulting to false in Configs.cpp
presto-native-execution/presto_cpp/main/common/Configs.h
presto-native-execution/presto_cpp/main/common/Configs.cpp
Advertise HTTP/2 protocol during SSL negotiation when enabled
  • Include Configs.h in Utils.cpp
  • Branch on exchangeHttp2Enabled() to set next protocols to {"h2","http/1.1"} or fallback
presto-native-execution/presto_cpp/main/common/Utils.cpp
Conditionally set HTTP version in outgoing requests
  • Include Configs.h in HttpClient.h
  • Wrap headers_.setHTTPVersion(1,1) under exchangeHttp2Enabled() check
presto-native-execution/presto_cpp/main/http/HttpClient.h
Enforce non-chunked responses when HTTP/2 is disabled
  • Include Configs.h in PrestoExchangeSource.cpp
  • Wrap VELOX_CHECK against chunked transfer under config guard
presto-native-execution/presto_cpp/main/PrestoExchangeSource.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

arhimondr
arhimondr previously approved these changes Oct 26, 2025
@steveburnett
Copy link
Contributor

"Introduce a new configuration flag for HTTP/2 in SystemConfig" - is this config user-controllable? If so, please include documentation.

Copy link
Contributor

@amitkdutta amitkdutta left a comment

Choose a reason for hiding this comment

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

Some minor comments.

@kewang1024 kewang1024 force-pushed the http2 branch 3 times, most recently from 0c4b0a7 to 6b39ec7 Compare October 27, 2025 23:04
@kewang1024 kewang1024 force-pushed the http2 branch 6 times, most recently from b34eda7 to 8ca50dd Compare October 28, 2025 02:39
steveburnett
steveburnett previously approved these changes Oct 28, 2025
Copy link
Contributor

@steveburnett steveburnett left a comment

Choose a reason for hiding this comment

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

LGTM! (docs)

Pull branch, local doc build, looks good. Thanks!

@kewang1024 kewang1024 requested a review from amitkdutta October 28, 2025 17:31
@kewang1024 kewang1024 force-pushed the http2 branch 2 times, most recently from 25c4258 to daa2ff4 Compare October 28, 2025 23:30
@kewang1024 kewang1024 requested a review from amitkdutta October 29, 2025 00:39
* **Type:** ``boolean``
* **Default value:** ``false``

Specifies whether HTTP/2 should be enabled for exchange HTTP client.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since now enable it for everything (exchange or othewrise), we can rename it somply http2_enabled as nothing specific to exchange is happening. Also lets do that for all variables and PR title.

Copy link
Contributor

@amitkdutta amitkdutta left a comment

Choose a reason for hiding this comment

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

Small renaming! Overall looking great.

kewang1024 added a commit to kewang1024/presto that referenced this pull request Oct 29, 2025
Summary:
```
== RELEASE NOTES ==

General Changes
* Add http2 support for http client

```


Differential Revision: D85546226

Pulled By: kewang1024
@kewang1024 kewang1024 changed the title feat(native): Add http2 support for exchange client feat(native): Add http2 support for http client Oct 29, 2025
@kewang1024 kewang1024 changed the title feat(native): Add http2 support for http client feat(native): Add http2 support for HTTP client Oct 29, 2025
@kewang1024 kewang1024 requested a review from amitkdutta October 29, 2025 04:35
amitkdutta
amitkdutta previously approved these changes Oct 29, 2025
kewang1024 added a commit to kewang1024/presto that referenced this pull request Oct 29, 2025
Summary:
```
== RELEASE NOTES ==

General Changes
* Add http2 support for http client

```


Differential Revision: D85546226

Pulled By: kewang1024
kewang1024 added a commit to kewang1024/presto that referenced this pull request Oct 29, 2025
Summary:
```
== RELEASE NOTES ==

General Changes
* Add http2 support for http client

```


Differential Revision: D85546226

Pulled By: kewang1024
Summary:
```
== RELEASE NOTES ==

General Changes
* Add http2 support for http client

```


Differential Revision: D85546226

Pulled By: kewang1024
Copy link
Contributor

@amitkdutta amitkdutta left a comment

Choose a reason for hiding this comment

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

Thanks @kewang1024 for iterating over it. Looks great.

@kewang1024 kewang1024 merged commit a252163 into prestodb:master Oct 29, 2025
94 of 127 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:Meta PR from Meta

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants