Fixed error with 'max_memory_usage_for_user' setting during distributed query execution [#METR-24117].

This commit is contained in:
Alexey Milovidov 2017-01-14 04:55:35 +03:00
parent f7402a524e
commit b16c9a3e12

View File

@ -29,10 +29,12 @@ BlockInputStreams Query::execute()
Settings new_settings = settings;
new_settings.queue_max_wait_ms = Cluster::saturate(new_settings.queue_max_wait_ms, settings.limits.max_execution_time);
/// Не имеет смысла на удалённых серверах, так как запрос отправляется обычно с другим user-ом.
new_settings.max_concurrent_queries_for_user = 0;
/// Ограничение сетевого трафика, если нужно.
/// Does not matter on remote servers, because queries are sent under different user.
new_settings.max_concurrent_queries_for_user = 0;
new_settings.limits.max_memory_usage_for_user = 0;
/// Network bandwidth limit, if needed.
ThrottlerPtr throttler;
if (settings.limits.max_network_bandwidth || settings.limits.max_network_bytes)
throttler = std::make_shared<Throttler>(
@ -40,7 +42,7 @@ BlockInputStreams Query::execute()
settings.limits.max_network_bytes,
"Limit for bytes to send or receive over network exceeded.");
/// Распределить шарды равномерно по потокам.
/// Spread shards by threads uniformly.
size_t remote_count = 0;
@ -72,7 +74,8 @@ BlockInputStreams Query::execute()
ConnectionPoolsPtr pools;
bool do_init = true;
/// Цикл по шардам.
/// Loop over shards.
size_t current_thread = 0;
for (const auto & shard_info : cluster->getShardsInfo())
{
@ -86,7 +89,7 @@ BlockInputStreams Query::execute()
if (create_local_queries)
{
/// Добавляем запросы к локальному ClickHouse.
/// Add queries to localhost (they are processed in-process, without network communication).
DB::Context new_context = context;
new_context.setSettings(new_settings);