Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions pkg/model/chi/ch_config_generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const (
// 2. Cluster with all shards (1 replica). Used to gather/scatter data over all replicas.
OneShardAllReplicasClusterName = "all-replicated"
AllShardsOneReplicaClusterName = "all-sharded"
AllClustersClusterName = "all-clusters"
)

// ClickHouseConfigGenerator generates ClickHouse configuration files content for specified CHI
Expand Down Expand Up @@ -438,6 +439,35 @@ func (c *ClickHouseConfigGenerator) GetRemoteServers(options *RemoteServersGener
})
// </my_cluster_name>
util.Iline(b, 8, "</%s>", clusterName)

// All shards from all clusters
util.Iline(b, 8, "<%s>", AllClustersClusterName)

c.chi.WalkClusters(func(cluster *api.Cluster) error {
cluster.WalkShards(func(index int, shard *api.ChiShard) error {
if c.ShardHostsNum(shard, options) < 1 {
// Skip empty shard
return nil
}
util.Iline(b, 12, "<shard>")
util.Iline(b, 12, " <internal_replication>%s</internal_replication>", shard.InternalReplication)

shard.WalkHosts(func(host *api.ChiHost) error {
if options.Include(host) {
c.getRemoteServersReplica(host, b)
}
return nil
})
util.Iline(b, 12, "</shard>")

return nil
})

return nil
})

// </my_cluster_name>
util.Iline(b, 8, "</%s>", clusterName)
}

// </remote_servers>
Expand Down