From aee1a78fb5147b836da2c18668a80d0c001855bd Mon Sep 17 00:00:00 2001 From: Jimmy Lu Date: Wed, 5 Jun 2024 15:59:55 -0400 Subject: [PATCH] [native] Switch to HEAD method for exchange get size call --- .../presto_cpp/main/PrestoExchangeSource.cpp | 13 +++++-------- .../presto_cpp/main/TaskResource.cpp | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/presto-native-execution/presto_cpp/main/PrestoExchangeSource.cpp b/presto-native-execution/presto_cpp/main/PrestoExchangeSource.cpp index 60dd424ae2ae0..aa7c1a798586c 100644 --- a/presto-native-execution/presto_cpp/main/PrestoExchangeSource.cpp +++ b/presto-native-execution/presto_cpp/main/PrestoExchangeSource.cpp @@ -177,17 +177,14 @@ 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; + } else { + method = proxygen::HTTPMethod::GET; } + auto requestBuilder = http::RequestBuilder().method(method).url(path); velox::common::testutil::TestValue::adjust( "facebook::presto::PrestoExchangeSource::doRequest", this); diff --git a/presto-native-execution/presto_cpp/main/TaskResource.cpp b/presto-native-execution/presto_cpp/main/TaskResource.cpp index 7fec284615944..0885a7234cc66 100644 --- a/presto-native-execution/presto_cpp/main/TaskResource.cpp +++ b/presto-native-execution/presto_cpp/main/TaskResource.cpp @@ -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(