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

[native] Switch to HEAD method for exchange get size call #22697

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -179,17 +179,16 @@ void PrestoExchangeSource::doRequest(
}

auto path = fmt::format("{}/{}", basePath_, sequence_);
VLOG(1) << "Fetching data from " << host_ << ":" << port_ << " " << path;
auto self = getSelfPtr();
auto requestBuilder =
http::RequestBuilder().method(proxygen::HTTPMethod::GET).url(path);

proxygen::HTTPMethod method;
if (maxBytes == 0) {
requestBuilder.header(protocol::PRESTO_GET_DATA_SIZE_HEADER, "true");
// Coordinator ignores the header and always sends back data. There is only
// one coordinator to fetch data from, so a limit of 1MB is enough.
maxBytes = 1 << 20;
method = proxygen::HTTPMethod::HEAD;
VLOG(1) << "Get data sizes from " << host_ << ":" << port_ << " " << path;
} else {
method = proxygen::HTTPMethod::GET;
VLOG(1) << "Fetching data from " << host_ << ":" << port_ << " " << path;
}
auto requestBuilder = http::RequestBuilder().method(method).url(path);

velox::common::testutil::TestValue::adjust(
"facebook::presto::PrestoExchangeSource::doRequest", this);
Expand Down Expand Up @@ -289,6 +288,7 @@ void PrestoExchangeSource::processDataResponse(
auto remainingBytesString = headers->getHeaders().getSingleOrEmpty(
protocol::PRESTO_BUFFER_REMAINING_BYTES_HEADER);
if (!remainingBytesString.empty()) {
VLOG(1) << "Remaining bytes: " << remainingBytesString;
folly::split(',', remainingBytesString, remainingBytes);
if (!remainingBytes.empty() && remainingBytes[0] == 0) {
VELOX_CHECK_EQ(remainingBytes.size(), 1);
Expand Down
2 changes: 1 addition & 1 deletion presto-native-execution/presto_cpp/main/TaskResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ proxygen::RequestHandler* TaskResource::getResults(
auto maxWait = getMaxWait(message).value_or(
protocol::Duration(protocol::PRESTO_MAX_WAIT_DEFAULT));
protocol::DataSize maxSize;
if (getDataSize || headers.exists(protocol::PRESTO_GET_DATA_SIZE_HEADER)) {
if (getDataSize) {
maxSize = protocol::DataSize(0, protocol::DataUnit::BYTE);
} else {
maxSize = protocol::DataSize(
Expand Down
Loading