mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
dbms: added load_balancing to settings [#METR-9350]
This commit is contained in:
parent
ec2e5ff860
commit
cc3882b81f
@ -48,6 +48,16 @@ struct Settings
|
||||
/// Использовать ли SplittingAggregator вместо обычного. Он быстрее для запросов с большим состоянием агрегации.
|
||||
bool use_splitting_aggregator;
|
||||
|
||||
enum LoadBalancing
|
||||
{
|
||||
/// среди реплик с минимальным количеством ошибок выбирается случайная
|
||||
RANDOM = 1,
|
||||
/// среди реплик с минимальным количеством ошибок выбирается реплика
|
||||
/// с минимальным количеством отличающихся символов в имени реплики и имени локального хоста
|
||||
NEAREST_HOSTNAME = 2
|
||||
};
|
||||
size_t load_balancing;
|
||||
|
||||
/// Всевозможные ограничения на выполнение запроса.
|
||||
Limits limits;
|
||||
|
||||
@ -66,7 +76,8 @@ struct Settings
|
||||
poll_interval(DBMS_DEFAULT_POLL_INTERVAL),
|
||||
distributed_connections_pool_size(DBMS_DEFAULT_DISTRIBUTED_CONNECTIONS_POOL_SIZE),
|
||||
connections_with_failover_max_tries(DBMS_CONNECTION_POOL_WITH_FAILOVER_DEFAULT_MAX_TRIES),
|
||||
sign_rewrite(false), extremes(false), use_uncompressed_cache(true), use_splitting_aggregator(false)
|
||||
sign_rewrite(false), extremes(false), use_uncompressed_cache(true), use_splitting_aggregator(false),
|
||||
load_balancing(NEAREST_HOSTNAME)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -34,6 +34,7 @@ void Settings::set(const String & name, const Field & value)
|
||||
else if (name == "use_uncompressed_cache") use_uncompressed_cache = safeGet<UInt64>(value);
|
||||
else if (name == "use_splitting_aggregator") use_splitting_aggregator = safeGet<UInt64>(value);
|
||||
else if (name == "profile") setProfile(get<const String &>(value));
|
||||
else if (name == "load_balancing") load_balancing = safeGet<UInt64>(value);
|
||||
else if (!limits.trySet(name, value))
|
||||
throw Exception("Unknown setting " + name, ErrorCodes::UNKNOWN_SETTING);
|
||||
}
|
||||
@ -57,7 +58,8 @@ void Settings::set(const String & name, ReadBuffer & buf)
|
||||
|| name == "sign_rewrite"
|
||||
|| name == "extremes"
|
||||
|| name == "use_uncompressed_cache"
|
||||
|| name == "use_splitting_aggregator")
|
||||
|| name == "use_splitting_aggregator"
|
||||
|| name == "load_balancing")
|
||||
{
|
||||
UInt64 value = 0;
|
||||
readVarUInt(value, buf);
|
||||
@ -92,7 +94,8 @@ void Settings::set(const String & name, const String & value)
|
||||
|| name == "sign_rewrite"
|
||||
|| name == "extremes"
|
||||
|| name == "use_uncompressed_cache"
|
||||
|| name == "use_splitting_aggregator")
|
||||
|| name == "use_splitting_aggregator"
|
||||
|| name == "load_balancing")
|
||||
{
|
||||
set(name, parse<UInt64>(value));
|
||||
}
|
||||
@ -154,6 +157,7 @@ void Settings::serialize(WriteBuffer & buf) const
|
||||
writeStringBinary("extremes", buf); writeVarUInt(extremes, buf);
|
||||
writeStringBinary("use_uncompressed_cache", buf); writeVarUInt(use_uncompressed_cache, buf);
|
||||
writeStringBinary("use_splitting_aggregator", buf); writeVarUInt(use_splitting_aggregator, buf);
|
||||
writeStringBinary("load_balancing", buf); writeVarUInt(load_balancing, buf);
|
||||
|
||||
limits.serialize(buf);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user