dbms: addition to prev. revision [#CONV-2944].

This commit is contained in:
Alexey Milovidov 2012-10-16 18:12:29 +00:00
parent bb3fedcd55
commit d2ed0ae566

View File

@ -1,5 +1,7 @@
#pragma once #pragma once
#include <Yandex/logger_useful.h>
#include <DB/DataStreams/IProfilingBlockInputStream.h> #include <DB/DataStreams/IProfilingBlockInputStream.h>
#include <DB/Client/Connection.h> #include <DB/Client/Connection.h>
@ -14,7 +16,8 @@ class RemoteBlockInputStream : public IProfilingBlockInputStream
{ {
public: public:
RemoteBlockInputStream(Connection & connection_, const String & query_, QueryProcessingStage::Enum stage_ = QueryProcessingStage::Complete) RemoteBlockInputStream(Connection & connection_, const String & query_, QueryProcessingStage::Enum stage_ = QueryProcessingStage::Complete)
: connection(connection_), query(query_), stage(stage_), sent_query(false), finished(false), cancelled(false) : connection(connection_), query(query_), stage(stage_), sent_query(false), finished(false), cancelled(false),
log(&Logger::get("RemoteBlockInputStream (" + connection.getServerAddress() + ")"))
{ {
} }
@ -33,6 +36,8 @@ public:
{ {
if (is_cancelled_callback && is_cancelled_callback()) if (is_cancelled_callback && is_cancelled_callback())
{ {
LOG_TRACE(log, "Cancelling query");
/// Если да - запросим удалённый сервер тоже прервать запрос. /// Если да - запросим удалённый сервер тоже прервать запрос.
cancelled = true; cancelled = true;
connection.sendCancel(); connection.sendCancel();
@ -83,6 +88,8 @@ public:
{ {
if (!cancelled) if (!cancelled)
{ {
LOG_TRACE(log, "Cancelling query because enough data has been read");
cancelled = true; cancelled = true;
connection.sendCancel(); connection.sendCancel();
} }
@ -122,6 +129,8 @@ private:
bool sent_query; bool sent_query;
bool finished; bool finished;
bool cancelled; bool cancelled;
Logger * log;
}; };
} }