提交 ee6a7ee2 编写于 作者: A Alexey Milovidov

Allow to disable replicated max parallel fetches/sends [#CLICKHOUSE-2960].

上级 563e2124
......@@ -55,8 +55,8 @@ void Service::processQuery(const Poco::Net::HTMLForm & params, ReadBuffer & body
static std::atomic_uint total_sends {0};
if (total_sends >= data.settings.replicated_max_parallel_sends
|| data.current_table_sends >= data.settings.replicated_max_parallel_sends_for_table)
if ((data.settings.replicated_max_parallel_sends && total_sends >= data.settings.replicated_max_parallel_sends)
|| (data.settings.replicated_max_parallel_sends_for_table && data.current_table_sends >= data.settings.replicated_max_parallel_sends_for_table))
{
response.setStatus(std::to_string(HTTP_TOO_MANY_REQUESTS));
response.setReason("Too many concurrent fetches, try again later");
......
#pragma once
#include <Poco/Util/AbstractConfiguration.h>
#include <Core/Defines.h>
#include <Core/Types.h>
......
......@@ -1255,7 +1255,7 @@ bool StorageReplicatedMergeTree::executeLogEntry(const LogEntry & entry)
String replica = findReplicaHavingCoveringPart(entry.new_part_name, true, covering_part);
static std::atomic_uint total_fetches {0};
if (total_fetches >= data.settings.replicated_max_parallel_fetches)
if (data.settings.replicated_max_parallel_fetches && total_fetches >= data.settings.replicated_max_parallel_fetches)
{
throw Exception("Too much total fetches from replicas, maximum: " + toString(data.settings.replicated_max_parallel_fetches),
ErrorCodes::TOO_MUCH_FETCHES);
......@@ -1264,7 +1264,7 @@ bool StorageReplicatedMergeTree::executeLogEntry(const LogEntry & entry)
++total_fetches;
SCOPE_EXIT({--total_fetches;});
if (current_table_fetches >= data.settings.replicated_max_parallel_fetches_for_table)
if (data.settings.replicated_max_parallel_fetches_for_table && current_table_fetches >= data.settings.replicated_max_parallel_fetches_for_table)
{
throw Exception("Too much fetches from replicas for table, maximum: " + toString(data.settings.replicated_max_parallel_fetches_for_table),
ErrorCodes::TOO_MUCH_FETCHES);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册