mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-26 09:32:01 +00:00
dbms: addition to prev. revision [#METR-10500].
This commit is contained in:
parent
763f354b3d
commit
a3efebda9d
@ -15,12 +15,8 @@ namespace DB
|
|||||||
*/
|
*/
|
||||||
class RemoteBlockInputStream : public IProfilingBlockInputStream
|
class RemoteBlockInputStream : public IProfilingBlockInputStream
|
||||||
{
|
{
|
||||||
public:
|
private:
|
||||||
/// Принимает готовое соединение.
|
void init(const Settings * settings_)
|
||||||
RemoteBlockInputStream(ConnectionPool::Entry pool_entry_, const String & query_, const Settings * settings_,
|
|
||||||
const Tables & external_tables_ = Tables(), QueryProcessingStage::Enum stage_ = QueryProcessingStage::Complete)
|
|
||||||
: connection(pool_entry_), query(query_),
|
|
||||||
external_tables(external_tables_), stage(stage_)
|
|
||||||
{
|
{
|
||||||
if (settings_)
|
if (settings_)
|
||||||
{
|
{
|
||||||
@ -30,20 +26,29 @@ public:
|
|||||||
else
|
else
|
||||||
send_settings = false;
|
send_settings = false;
|
||||||
}
|
}
|
||||||
|
public:
|
||||||
|
/// Принимает готовое соединение.
|
||||||
|
RemoteBlockInputStream(Connection & connection_, const String & query_, const Settings * settings_,
|
||||||
|
const Tables & external_tables_ = Tables(), QueryProcessingStage::Enum stage_ = QueryProcessingStage::Complete)
|
||||||
|
: connection(&connection_), query(query_), external_tables(external_tables_), stage(stage_)
|
||||||
|
{
|
||||||
|
init(settings_);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Принимает готовое соединение. Захватывает владение соединением из пула.
|
||||||
|
RemoteBlockInputStream(ConnectionPool::Entry & pool_entry_, const String & query_, const Settings * settings_,
|
||||||
|
const Tables & external_tables_ = Tables(), QueryProcessingStage::Enum stage_ = QueryProcessingStage::Complete)
|
||||||
|
: pool_entry(pool_entry_), connection(&*pool_entry_), query(query_), external_tables(external_tables_), stage(stage_)
|
||||||
|
{
|
||||||
|
init(settings_);
|
||||||
|
}
|
||||||
|
|
||||||
/// Принимает пул, из которого нужно будет достать соединение.
|
/// Принимает пул, из которого нужно будет достать соединение.
|
||||||
RemoteBlockInputStream(IConnectionPool * pool_, const String & query_, const Settings * settings_,
|
RemoteBlockInputStream(IConnectionPool * pool_, const String & query_, const Settings * settings_,
|
||||||
const Tables & external_tables_ = Tables(), QueryProcessingStage::Enum stage_ = QueryProcessingStage::Complete)
|
const Tables & external_tables_ = Tables(), QueryProcessingStage::Enum stage_ = QueryProcessingStage::Complete)
|
||||||
: pool(pool_), query(query_),
|
: pool(pool_), query(query_), external_tables(external_tables_), stage(stage_)
|
||||||
external_tables(external_tables_), stage(stage_)
|
|
||||||
{
|
{
|
||||||
if (settings_)
|
init(settings_);
|
||||||
{
|
|
||||||
send_settings = true;
|
|
||||||
settings = *settings_;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
send_settings = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +119,10 @@ protected:
|
|||||||
{
|
{
|
||||||
/// Если надо - достаём соединение из пула.
|
/// Если надо - достаём соединение из пула.
|
||||||
if (pool)
|
if (pool)
|
||||||
connection = pool->get(send_settings ? &settings : nullptr);
|
{
|
||||||
|
pool_entry = pool->get(send_settings ? &settings : nullptr);
|
||||||
|
connection = &*pool_entry;
|
||||||
|
}
|
||||||
|
|
||||||
connection->sendQuery(query, "", stage, send_settings ? &settings : nullptr, true);
|
connection->sendQuery(query, "", stage, send_settings ? &settings : nullptr, true);
|
||||||
sendExternalTables();
|
sendExternalTables();
|
||||||
@ -230,7 +238,8 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
IConnectionPool * pool = nullptr;
|
IConnectionPool * pool = nullptr;
|
||||||
ConnectionPool::Entry connection;
|
ConnectionPool::Entry pool_entry;
|
||||||
|
Connection * connection = nullptr;
|
||||||
|
|
||||||
const String query;
|
const String query;
|
||||||
bool send_settings;
|
bool send_settings;
|
||||||
|
Loading…
Reference in New Issue
Block a user