mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 15:42:02 +00:00
update config structure: remote_servers_discovery -> remote_servers.discovery
This commit is contained in:
parent
7404205f37
commit
ceec643f90
@ -327,6 +327,10 @@ void Clusters::updateClusters(const Poco::Util::AbstractConfiguration & new_conf
|
||||
|
||||
for (const auto & key : new_config_keys)
|
||||
{
|
||||
if (new_config.has(config_prefix + "." + key + ".discovery"))
|
||||
/// Handled in ClusterDiscovery
|
||||
continue;
|
||||
|
||||
if (key.find('.') != String::npos)
|
||||
throw Exception("Cluster names with dots are not supported: '" + key + "'", ErrorCodes::SYNTAX_ERROR);
|
||||
|
||||
@ -489,10 +493,6 @@ Cluster::Cluster(const Poco::Util::AbstractConfiguration & config,
|
||||
internal_replication
|
||||
});
|
||||
}
|
||||
else if (startsWith(key, "discovery"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
throw Exception("Unknown element in config: " + key, ErrorCodes::UNKNOWN_ELEMENT_IN_CONFIG);
|
||||
|
||||
|
@ -103,7 +103,10 @@ ClusterDiscovery::ClusterDiscovery(
|
||||
|
||||
for (const auto & key : config_keys)
|
||||
{
|
||||
String path = config.getString(config_prefix + "." + key + ".path");
|
||||
String prefix = config_prefix + "." + key + ".discovery";
|
||||
if (!config.has(prefix))
|
||||
continue;
|
||||
String path = config.getString(prefix + ".path");
|
||||
trimRight(path, '/');
|
||||
clusters_info.emplace(key, ClusterInfo(key, path));
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
ClusterDiscovery(
|
||||
const Poco::Util::AbstractConfiguration & config,
|
||||
ContextPtr context_,
|
||||
const String & config_prefix = "remote_servers_discovery"); // TODO(@vdimir) use `remote_servers`
|
||||
const String & config_prefix = "remote_servers");
|
||||
|
||||
void start();
|
||||
|
||||
|
@ -1,7 +1,25 @@
|
||||
<clickhouse>
|
||||
<remote_servers_discovery>
|
||||
<remote_servers>
|
||||
|
||||
<test_auto_cluster>
|
||||
<path>/clickhouse/discovery/test_auto_cluster</path>
|
||||
<discovery>
|
||||
<path>/clickhouse/discovery/test_auto_cluster</path>
|
||||
</discovery>
|
||||
</test_auto_cluster>
|
||||
</remote_servers_discovery>
|
||||
|
||||
<two_shards>
|
||||
<!-- just to check that there's no conflict between automatic and manual clusters -->
|
||||
<shard>
|
||||
<replica>
|
||||
<host>node1</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
<replica>
|
||||
<host>node2</host>
|
||||
<port>9000</port>
|
||||
</replica>
|
||||
</shard>
|
||||
</two_shards>
|
||||
|
||||
</remote_servers>
|
||||
</clickhouse>
|
||||
|
@ -28,6 +28,7 @@ def check_nodes_count_in_cluster(nodes, expected, cluster_name, *, retries=5):
|
||||
"""
|
||||
Check nodes count in system.clusters for specified cluster
|
||||
"""
|
||||
assert 1 <= retries <= 6
|
||||
|
||||
for retry in range(1, retries + 1):
|
||||
nodes_cnt = [
|
||||
@ -62,3 +63,5 @@ def test_cluster_discovery_startup_and_stop(start_cluster):
|
||||
|
||||
nodes[3].start_clickhouse()
|
||||
check_nodes_count_in_cluster([nodes[0], nodes[2]], len(nodes), 'test_auto_cluster')
|
||||
|
||||
check_nodes_count_in_cluster([nodes[1], nodes[2]], 2, 'two_shards', retries=1)
|
||||
|
Loading…
Reference in New Issue
Block a user