mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 17:20:50 +00:00
dbms: fixed error [#METR-20301].
This commit is contained in:
parent
711e7c7245
commit
b92b0660a7
@ -264,8 +264,7 @@ public:
|
||||
*/
|
||||
void resetCaches() const;
|
||||
|
||||
void initClusters();
|
||||
Cluster & getCluster(const std::string & cluster_name);
|
||||
const Cluster & getCluster(const std::string & cluster_name) const;
|
||||
Poco::SharedPtr<Clusters> getClusters() const;
|
||||
|
||||
Compiler & getCompiler();
|
||||
|
@ -112,7 +112,7 @@ struct ContextShared
|
||||
|
||||
/// Кластеры для distributed таблиц
|
||||
/// Создаются при создании Distributed таблиц, так как нужно дождаться пока будут выставлены Settings
|
||||
Poco::SharedPtr<Clusters> clusters;
|
||||
mutable Poco::SharedPtr<Clusters> clusters;
|
||||
|
||||
Poco::UUIDGenerator uuid_generator;
|
||||
|
||||
@ -892,18 +892,14 @@ UInt16 Context::getTCPPort() const
|
||||
}
|
||||
|
||||
|
||||
void Context::initClusters()
|
||||
const Cluster & Context::getCluster(const std::string & cluster_name) const
|
||||
{
|
||||
{
|
||||
Poco::ScopedLock<Poco::Mutex> lock(shared->mutex);
|
||||
if (!shared->clusters)
|
||||
shared->clusters = new Clusters(settings);
|
||||
}
|
||||
|
||||
Cluster & Context::getCluster(const std::string & cluster_name)
|
||||
{
|
||||
if (!shared->clusters)
|
||||
throw Poco::Exception("Clusters have not been initialized yet.");
|
||||
|
||||
Clusters::Impl::iterator it = shared->clusters->impl.find(cluster_name);
|
||||
if (it != shared->clusters->impl.end())
|
||||
return it->second;
|
||||
@ -913,8 +909,12 @@ Cluster & Context::getCluster(const std::string & cluster_name)
|
||||
|
||||
Poco::SharedPtr<Clusters> Context::getClusters() const
|
||||
{
|
||||
{
|
||||
Poco::ScopedLock<Poco::Mutex> lock(shared->mutex);
|
||||
if (!shared->clusters)
|
||||
throw Poco::Exception("Clusters have not been initialized yet.");
|
||||
shared->clusters = new Clusters(settings);
|
||||
}
|
||||
|
||||
return shared->clusters;
|
||||
}
|
||||
|
||||
|
@ -131,8 +131,6 @@ StoragePtr StorageDistributed::create(
|
||||
const ASTPtr & sharding_key_,
|
||||
const String & data_path_)
|
||||
{
|
||||
context_.initClusters();
|
||||
|
||||
return (new StorageDistributed{
|
||||
name_, columns_,
|
||||
materialized_columns_, alias_columns_, column_defaults_,
|
||||
|
@ -29,7 +29,6 @@ StorageSystemClusters::StorageSystemClusters(const std::string & name_, Context
|
||||
|
||||
StoragePtr StorageSystemClusters::create(const std::string & name_, Context & context_)
|
||||
{
|
||||
context_.initClusters();
|
||||
return (new StorageSystemClusters{name_, context_})->thisPtr();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user