diff --git a/src/Interpreters/ClusterDiscovery.cpp b/src/Interpreters/ClusterDiscovery.cpp index 02046dec066..ce59dfcae45 100644 --- a/src/Interpreters/ClusterDiscovery.cpp +++ b/src/Interpreters/ClusterDiscovery.cpp @@ -125,10 +125,12 @@ ClusterDiscovery::ClusterDiscovery( ClusterInfo( /* name_= */ key, /* zk_root_= */ config.getString(prefix + ".path"), + /* host_name= */ config.getString(prefix + ".my_hostname", getFQDNOrHostName()), /* port= */ context->getTCPPort(), /* secure= */ config.getBool(prefix + ".secure", false), /* shard_id= */ config.getUInt(prefix + ".shard", 0), - /* observer_mode= */ ConfigHelper::getBool(config, prefix + ".observer") + /* observer_mode= */ ConfigHelper::getBool(config, prefix + ".observer"), + /* invisible_mode= */ ConfigHelper::getBool(config, prefix + ".invisible") ) ); } @@ -294,6 +296,12 @@ bool ClusterDiscovery::updateCluster(ClusterInfo & cluster_info) return false; } + if (cluster_info.current_cluster_is_invisible) + { + LOG_DEBUG(log, "cluster '{}' is invisible!", cluster_info.name); + return true; + } + if (!needUpdate(node_uuids, nodes_info)) { LOG_DEBUG(log, "No update required for cluster '{}'", cluster_info.name); diff --git a/src/Interpreters/ClusterDiscovery.h b/src/Interpreters/ClusterDiscovery.h index 8c976ca1b7f..140e3691c03 100644 --- a/src/Interpreters/ClusterDiscovery.h +++ b/src/Interpreters/ClusterDiscovery.h @@ -3,7 +3,6 @@ #include #include #include -#include #include #include @@ -78,16 +77,24 @@ private: /// Current node may not belong to cluster, to be just an observer. bool current_node_is_observer = false; + /// For internal management need. + /// Is it designed that when deploying multiple compute groups, + /// they are mutually invisible to each other. + bool current_cluster_is_invisible = false; + explicit ClusterInfo(const String & name_, const String & zk_root_, + const String & host_name, UInt16 port, bool secure, size_t shard_id, - bool observer_mode) + bool observer_mode, + bool invisible) : name(name_) , zk_root(zk_root_) - , current_node(getFQDNOrHostName() + ":" + toString(port), secure, shard_id) + , current_node(host_name + ":" + toString(port), secure, shard_id) , current_node_is_observer(observer_mode) + , current_cluster_is_invisible(invisible) { } };