From 44b20eee96a9c6adc17baa5894984c2701ec0800 Mon Sep 17 00:00:00 2001 From: alexey-milovidov Date: Tue, 9 Jun 2020 10:23:35 +0300 Subject: [PATCH] Revert "S3 HTTP client - Avoid copying response stream into memory" --- contrib/aws | 2 +- src/IO/S3/PocoHTTPClient.cpp | 5 ++--- src/IO/S3/PocoHTTPResponseStream.cpp | 12 ------------ src/IO/S3/PocoHTTPResponseStream.h | 21 --------------------- 4 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 src/IO/S3/PocoHTTPResponseStream.cpp delete mode 100644 src/IO/S3/PocoHTTPResponseStream.h diff --git a/contrib/aws b/contrib/aws index 17e10c0fc77..f7d9ce39f41 160000 --- a/contrib/aws +++ b/contrib/aws @@ -1 +1 @@ -Subproject commit 17e10c0fc77f22afe890fa6d1b283760e5edaa56 +Subproject commit f7d9ce39f41323300044567be007c233338bb94a diff --git a/src/IO/S3/PocoHTTPClient.cpp b/src/IO/S3/PocoHTTPClient.cpp index 0dfa80ca107..b8de483a5a8 100644 --- a/src/IO/S3/PocoHTTPClient.cpp +++ b/src/IO/S3/PocoHTTPClient.cpp @@ -2,8 +2,6 @@ #include #include -#include -#include #include #include #include @@ -151,7 +149,8 @@ void PocoHTTPClient::MakeRequestInternal( response->SetClientErrorMessage(error_message); } else - response->GetResponseStream().SetUnderlyingStream(std::make_shared(session, response_body_stream)); + /// TODO: Do not copy whole stream. + Poco::StreamCopier::copyStream(response_body_stream, response->GetResponseBody()); break; } diff --git a/src/IO/S3/PocoHTTPResponseStream.cpp b/src/IO/S3/PocoHTTPResponseStream.cpp deleted file mode 100644 index 0a198268f2e..00000000000 --- a/src/IO/S3/PocoHTTPResponseStream.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include "PocoHTTPResponseStream.h" - -#include - -namespace DB::S3 -{ -PocoHTTPResponseStream::PocoHTTPResponseStream(std::shared_ptr session_, std::istream & response_stream_) - : Aws::IStream(response_stream_.rdbuf()), session(std::move(session_)) -{ -} - -} diff --git a/src/IO/S3/PocoHTTPResponseStream.h b/src/IO/S3/PocoHTTPResponseStream.h deleted file mode 100644 index 8167ddc4346..00000000000 --- a/src/IO/S3/PocoHTTPResponseStream.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include -#include - -namespace DB::S3 -{ -/** - * Wrapper of IStream to store response stream and corresponding HTTP session. - */ -class PocoHTTPResponseStream : public Aws::IStream -{ -public: - PocoHTTPResponseStream(std::shared_ptr session_, std::istream & response_stream_); - -private: - /// Poco HTTP session is holder of response stream. - std::shared_ptr session; -}; - -}