Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'there are no such cluster here' #31723

Merged
merged 2 commits into from
Nov 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/Interpreters/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2129,21 +2129,20 @@ UInt16 Context::getServerPort(const String & port_name) const

std::shared_ptr<Cluster> Context::getCluster(const std::string & cluster_name) const
{
auto res = getClusters()->getCluster(cluster_name);
if (res)
if (auto res = tryGetCluster(cluster_name))
return res;
if (!cluster_name.empty())
res = tryGetReplicatedDatabaseCluster(cluster_name);
if (res)
return res;

throw Exception("Requested cluster '" + cluster_name + "' not found", ErrorCodes::BAD_GET);
}


std::shared_ptr<Cluster> Context::tryGetCluster(const std::string & cluster_name) const
{
return getClusters()->getCluster(cluster_name);
auto res = getClusters()->getCluster(cluster_name);
if (res)
return res;
if (!cluster_name.empty())
res = tryGetReplicatedDatabaseCluster(cluster_name);
return res;
}


Expand Down
2 changes: 1 addition & 1 deletion src/Interpreters/DDLTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ void DDLTask::setClusterInfo(ContextPtr context, Poco::Logger * log)

if (!cluster)
throw Exception(ErrorCodes::INCONSISTENT_CLUSTER_DEFINITION,
"DDL task {} contains current host {} in cluster {}, but there are no such cluster here.",
"DDL task {} contains current host {} in cluster {}, but there is no such cluster here.",
entry_name, host_id.readableString(), cluster_name);

/// Try to find host from task host list in cluster
Expand Down