Use proper timeouts when communicating with xdbc-bridge

This commit is contained in:
Alexey Milovidov 2020-06-16 01:35:15 +03:00
parent 1e73a56a77
commit 186d336e31
4 changed files with 11 additions and 5 deletions

View File

@ -109,7 +109,8 @@ public:
uri.setPath(IDENTIFIER_QUOTE_HANDLER); uri.setPath(IDENTIFIER_QUOTE_HANDLER);
uri.addQueryParameter("connection_string", getConnectionString()); uri.addQueryParameter("connection_string", getConnectionString());
ReadWriteBufferFromHTTP buf(uri, Poco::Net::HTTPRequest::HTTP_POST, nullptr); ReadWriteBufferFromHTTP buf(
uri, Poco::Net::HTTPRequest::HTTP_POST, {}, ConnectionTimeouts(http_timeout, http_timeout, http_timeout));
std::string character; std::string character;
readStringBinary(character, buf); readStringBinary(character, buf);
if (character.length() > 1) if (character.length() > 1)
@ -208,7 +209,8 @@ private:
{ {
try try
{ {
ReadWriteBufferFromHTTP buf(ping_url, Poco::Net::HTTPRequest::HTTP_GET, nullptr); ReadWriteBufferFromHTTP buf(
ping_url, Poco::Net::HTTPRequest::HTTP_GET, {}, ConnectionTimeouts(http_timeout, http_timeout, http_timeout));
return checkString(XDBCBridgeHelper::PING_OK_ANSWER, buf); return checkString(XDBCBridgeHelper::PING_OK_ANSWER, buf);
} }
catch (...) catch (...)

View File

@ -156,7 +156,8 @@ namespace detail
public: public:
using OutStreamCallback = std::function<void(std::ostream &)>; using OutStreamCallback = std::function<void(std::ostream &)>;
explicit ReadWriteBufferFromHTTPBase(UpdatableSessionPtr session_, explicit ReadWriteBufferFromHTTPBase(
UpdatableSessionPtr session_,
Poco::URI uri_, Poco::URI uri_,
const std::string & method_ = {}, const std::string & method_ = {},
OutStreamCallback out_stream_callback_ = {}, OutStreamCallback out_stream_callback_ = {},

View File

@ -7,7 +7,6 @@
#include <Storages/transformQueryForExternalDatabase.h> #include <Storages/transformQueryForExternalDatabase.h>
#include <common/logger_useful.h> #include <common/logger_useful.h>
#include <IO/ReadHelpers.h> #include <IO/ReadHelpers.h>
#include <IO/ReadWriteBufferFromHTTP.h>
#include <Poco/Net/HTTPRequest.h> #include <Poco/Net/HTTPRequest.h>
#include <Poco/Path.h> #include <Poco/Path.h>
#include <Common/ShellCommand.h> #include <Common/ShellCommand.h>

View File

@ -75,7 +75,11 @@ StoragePtr ITableFunctionXDBC::executeImpl(const ASTPtr & ast_function, const Co
columns_info_uri.addQueryParameter("external_table_functions_use_nulls", columns_info_uri.addQueryParameter("external_table_functions_use_nulls",
Poco::NumberFormatter::format(use_nulls)); Poco::NumberFormatter::format(use_nulls));
ReadWriteBufferFromHTTP buf(columns_info_uri, Poco::Net::HTTPRequest::HTTP_POST, nullptr); ReadWriteBufferFromHTTP buf(columns_info_uri, Poco::Net::HTTPRequest::HTTP_POST, {},
ConnectionTimeouts(
context.getSettingsRef().http_connection_timeout,
context.getSettingsRef().http_send_timeout,
context.getSettingsRef().http_receive_timeout));
std::string columns_info; std::string columns_info;
readStringBinary(columns_info, buf); readStringBinary(columns_info, buf);