mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
dbms: added value 'in_order' to setting 'load_balancing' [#METR-14782].
This commit is contained in:
parent
3effc70e18
commit
a1eb599105
@ -63,6 +63,8 @@ public:
|
||||
nested_pools[i].priority = hostname_differences[i];
|
||||
else if (load_balancing == LoadBalancing::RANDOM)
|
||||
nested_pools[i].priority = 0;
|
||||
else if (load_balancing == LoadBalancing::IN_ORDER)
|
||||
nested_pools[i].priority = i;
|
||||
else
|
||||
throw Exception("Unknown load_balancing_mode: " + toString(static_cast<int>(load_balancing)), ErrorCodes::LOGICAL_ERROR);
|
||||
}
|
||||
|
@ -232,7 +232,9 @@ enum class LoadBalancing
|
||||
RANDOM = 0,
|
||||
/// среди реплик с минимальным количеством ошибок выбирается реплика
|
||||
/// с минимальным количеством отличающихся символов в имени реплики и имени локального хоста
|
||||
NEAREST_HOSTNAME
|
||||
NEAREST_HOSTNAME,
|
||||
/// реплики перебираются строго по порядку; количество ошибок не имеет значение
|
||||
IN_ORDER,
|
||||
};
|
||||
|
||||
struct SettingLoadBalancing
|
||||
@ -249,14 +251,16 @@ struct SettingLoadBalancing
|
||||
{
|
||||
if (s == "random") return LoadBalancing::RANDOM;
|
||||
if (s == "nearest_hostname") return LoadBalancing::NEAREST_HOSTNAME;
|
||||
if (s == "in_order") return LoadBalancing::IN_ORDER;
|
||||
|
||||
throw Exception("Unknown load balancing mode: '" + s + "', must be one of 'random', 'nearest_hostname'", ErrorCodes::UNKNOWN_LOAD_BALANCING);
|
||||
throw Exception("Unknown load balancing mode: '" + s + "', must be one of 'random', 'nearest_hostname', 'in_order'",
|
||||
ErrorCodes::UNKNOWN_LOAD_BALANCING);
|
||||
}
|
||||
|
||||
String toString() const
|
||||
{
|
||||
const char * strings[] = {"random", "nearest_hostname"};
|
||||
if (value < LoadBalancing::RANDOM || value > LoadBalancing::NEAREST_HOSTNAME)
|
||||
const char * strings[] = {"random", "nearest_hostname", "in_order"};
|
||||
if (value < LoadBalancing::RANDOM || value > LoadBalancing::IN_ORDER)
|
||||
throw Exception("Unknown load balancing mode", ErrorCodes::UNKNOWN_OVERFLOW_MODE);
|
||||
return strings[static_cast<size_t>(value)];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user