Autodiscovery dynamic clusters#76001
Conversation
090ef8f to
df89516
Compare
3df8f59 to
04371dd
Compare
04371dd to
03df132
Compare
a32ee4c to
31ebcaa
Compare
31ebcaa to
98f9943
Compare
vdimir
left a comment
There was a problem hiding this comment.
Overall, this looks good, thanks for your contribution! The main suggestion is to update the documentation and review some of the other comments.
| /* | ||
| * Holds boolean flags for fixed set of keys. | ||
| * Flags can be concurrently set from different threads, and consumer can wait for it. | ||
| */ |
There was a problem hiding this comment.
Consider updating a comment rather than removing
| /// Reads data from zookeeper and tries to update cluster. | ||
| /// Returns true on success (or no update required). | ||
| bool ClusterDiscovery::updateCluster(ClusterInfo & cluster_info) | ||
| bool ClusterDiscovery::upsertCluster(ClusterInfo & cluster_info) |
There was a problem hiding this comment.
Can we also update a comment that this method can also create new cluster or remove it
| { | ||
| std::lock_guard lock(mutex); | ||
| cluster_impls.erase(name); | ||
| } | ||
| clusters_to_update->remove(name); | ||
| LOG_DEBUG(log, "Dynamic cluster '{}' removed successfully", name); |
There was a problem hiding this comment.
If we put clusters_to_update->remove(name); before cluster_impls.erase(name); would it solve issue with passing cluster_info.name to removeCluster ? If yes, are there other strong reason to order operations or not to like this?
There was a problem hiding this comment.
No, it can be in any order.
I did not remove record from clusters_info map, it's possible that at some moment we get cluster without nodes, when all nodes goes off, but we need to keep watch on this node in Keeper to restore cluster when nodes come back online. name is taken from clusters_info.
| String zk_root = zkutil::extractZooKeeperPath(zk_name_and_root, true); | ||
| String zk_name = zkutil::extractZooKeeperName(zk_name_and_root); | ||
| String zk_name_and_root = config.getString(cluster_config_prefix + ".path", ""); | ||
| String zk_multicluster_name_and_root = config.getString(cluster_config_prefix + ".multicluster_root_path", ""); |
There was a problem hiding this comment.
The option names multicluster_root_path and path seem a bit inconsistent to me. I would expect both to be either path/multicluster_path or root_path/multicluster_root_path. Or is it that multicluster_root_path corresponds to multiple clusters, meaning we would need several <path> entries to define them? If so, probably makes sense.
There was a problem hiding this comment.
And could you also update documentation https://github.com/ClickHouse/ClickHouse/blob/master/docs/en/operations/cluster-discovery.md accordingly with the new feature, please?
There was a problem hiding this comment.
<path> contains Keeper node for specific cluster, like /clickhouse/discovery/my_cluster.
<multicluster_root_path > contains parent node, root for multiple clusters, like /clickhouse/discovery, and each child subnode contains separate cluster.
So Keeper can have nodes
/clickhouse/discovery/my_cluster
/clickhouse/discovery/my_cluster_2
/clickhouse/discovery/my_cluster_3
and all clusters my_cluster, my_cluster_2, my_cluster_3 will be discovered.
| my_discovery_paths = multicluster_discovery_paths | ||
| ](auto) | ||
| { | ||
| (*my_discovery_paths)[zk_root_index - 1]->need_update = true; |
There was a problem hiding this comment.
| (*my_discovery_paths)[zk_root_index - 1]->need_update = true; | |
| my_discovery_paths->at(zk_root_index - 1)->need_update = true; |
b166f38 to
c5e7391
Compare
c5e7391 to
1428036
Compare
45ef349
|
@ianton-ru Hi, there is a data-race - https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=78123&sha=99e652c97c30e00334a988387f6fa21f4711bce0&name_0=PR&name_1=Integration%20tests%20%28tsan%2C%201%2F6%29 Can you please take a look? |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
<multicluster_root_path>.Documentation entry for user-facing changes
ClickHouse has a feature to discovery nodes in cluster (see setting
allow_experimental_cluster_discovery).This PR add ability to discover new clusters.
Nodes in new clusters keep the same way to register in Keeper
Added ability to discover all clusters in Keeper node