mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 16:50:48 +00:00
Fix local break on timeout
This commit is contained in:
parent
de36038733
commit
4390dde76c
@ -517,6 +517,7 @@ void ClientBase::receiveResult(ASTPtr parsed_query)
|
||||
const size_t poll_interval
|
||||
= std::max(min_poll_interval, std::min<size_t>(receive_timeout.totalMicroseconds(), default_poll_interval));
|
||||
|
||||
bool break_on_timeout = connection->getConnectionType() != IServerConnection::Type::LOCAL;
|
||||
while (true)
|
||||
{
|
||||
Stopwatch receive_watch(CLOCK_MONOTONIC_COARSE);
|
||||
@ -547,7 +548,7 @@ void ClientBase::receiveResult(ASTPtr parsed_query)
|
||||
else
|
||||
{
|
||||
double elapsed = receive_watch.elapsedSeconds();
|
||||
if (elapsed > receive_timeout.totalSeconds())
|
||||
if (break_on_timeout && elapsed > receive_timeout.totalSeconds())
|
||||
{
|
||||
std::cout << "Timeout exceeded while receiving data from server."
|
||||
<< " Waited for " << static_cast<size_t>(elapsed) << " seconds,"
|
||||
|
@ -60,6 +60,8 @@ public:
|
||||
|
||||
~Connection() override;
|
||||
|
||||
IServerConnection::Type getConnectionType() const override { return IServerConnection::Type::SERVER; }
|
||||
|
||||
static ServerConnectionPtr createConnection(const ConnectionParameters & parameters, ContextPtr context);
|
||||
|
||||
/// Set throttler of network traffic. One throttler could be used for multiple connections to limit total traffic.
|
||||
|
@ -56,6 +56,14 @@ class IServerConnection : boost::noncopyable
|
||||
public:
|
||||
virtual ~IServerConnection() = default;
|
||||
|
||||
enum class Type
|
||||
{
|
||||
SERVER,
|
||||
LOCAL
|
||||
};
|
||||
|
||||
virtual Type getConnectionType() const = 0;
|
||||
|
||||
virtual void setDefaultDatabase(const String & database) = 0;
|
||||
|
||||
virtual void getServerVersion(
|
||||
|
@ -56,6 +56,8 @@ public:
|
||||
|
||||
~LocalConnection() override;
|
||||
|
||||
IServerConnection::Type getConnectionType() const override { return IServerConnection::Type::LOCAL; }
|
||||
|
||||
static ServerConnectionPtr createConnection(const ConnectionParameters & connection_parameters, ContextPtr current_context, bool send_progress = false);
|
||||
|
||||
void setDefaultDatabase(const String & database) override;
|
||||
|
Loading…
Reference in New Issue
Block a user