[DBMON-6892] Fan out ClickHouse cluster queries over the resolved cluster name - #24920
[DBMON-6892] Fan out ClickHouse cluster queries over the resolved cluster name#24920sangeetashivaji wants to merge 3 commits into
Conversation
…ault Only ClickHouse Cloud names its cluster 'default'. Against a self-hosted deployment a hardcoded 'default' either raises UNKNOWN_CLUSTER or, when the stock localhost-only 'default' cluster exists, silently reads the local node alone while presenting the result as a whole-cluster view. Fan out over the cluster the instance actually belongs to, and read the local system table when no cluster can be resolved. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
evalya-impact-summaryevalya impact analysis |
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: d17393a | Docs | View more details | Give us feedback! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 423e93124a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| instead and callers fall back to the local system table. | ||
| """ | ||
| if self.cluster_name: | ||
| return self.cluster_name |
There was a problem hiding this comment.
Require an unambiguous cluster before fanning out
When a node participates in multiple configured clusters and has no {cluster} macro, cluster_name comes from CLUSTER_NAME_QUERY, which deliberately uses ORDER BY cluster LIMIT 1 (utils.py:62-70); that makes the tag stable but does not establish that the selected topology matches the load-balanced endpoint. Returning that value here now routes the affected single-endpoint metrics and DBM queries through an arbitrary cluster, potentially omitting nodes or querying an unrelated topology. Use this value for fan-out only when resolution is unambiguous, or provide an explicit fan-out cluster setting.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Does make sense but its a feature functionality that needs to be built to support multi cluster setup for single endpoint mode in self-hosted which we do not want to do.
There was a problem hiding this comment.
all system tables in cloud are under default cluster, self hosted single_endpoint_mode is the only impacted path here
Validation ReportAll 21 validations passed. Show details
|
What does this PR do?
Fixes the
clusterAllReplicasfan-out in single endpoint mode to use the cluster the instance actually belongs to, instead of a hardcoded'default'.ClickhouseCheck.fanout_cluster_name: the resolved cluster name, falling back to'default'only when the deployment is not known to be self-hosted (Cloud always uses that name).get_queries()andget_system_table()fan out over that cluster, and read the localsystem.<table>when no cluster can be resolved.cluster_aware_query(base, cluster)now takes the cluster, and cluster names are quoted and escaped throughquote_string()since they arrive as server-supplied data.Split out of #24889, which now carries only the
database_instancemetadata additions and is stacked on top of this branch.Motivation
Only ClickHouse Cloud names its cluster
default. Against a self-hosted deployment a hardcoded'default'either raisesUNKNOWN_CLUSTER, or — when the stock localhost-onlydefaultcluster exists — silently returns the local node alone while the result is presented as a whole-cluster view.Keeping this in its own PR keeps the changelog entries separate: this one is a
fixedentry, #24889 is anaddedentry.Review checklist (to be filled by reviewers)
qa/skip-qalabel if the PR does not need to be tested during QA. If the PR needs to be tested during QA, you should addqa/requiredlabel.backport/<branch-name>label to the PR and it will automatically open a backport PR once this one is merged