mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 02:52:13 +00:00
set zookeeper config
This commit is contained in:
parent
72bde1c688
commit
af5ecbef27
@ -363,6 +363,7 @@ struct ContextShared
|
||||
/// Initialized on demand (on distributed storages initialization) since Settings should be initialized
|
||||
std::unique_ptr<Clusters> clusters;
|
||||
ConfigurationPtr clusters_config; /// Stores updated configs
|
||||
ConfigurationPtr zookeeper_config; /// Stores zookeeperd configs
|
||||
mutable std::mutex clusters_mutex; /// Guards clusters and clusters_config
|
||||
|
||||
#if USE_EMBEDDED_COMPILER
|
||||
@ -1472,8 +1473,9 @@ zkutil::ZooKeeperPtr Context::getZooKeeper() const
|
||||
{
|
||||
std::lock_guard lock(shared->zookeeper_mutex);
|
||||
|
||||
const auto & config = shared->zookeeper_config ? *shared->zookeeper_config : getConfigRef();
|
||||
if (!shared->zookeeper)
|
||||
shared->zookeeper = std::make_shared<zkutil::ZooKeeper>(getConfigRef(), "zookeeper");
|
||||
shared->zookeeper = std::make_shared<zkutil::ZooKeeper>(config, "zookeeper");
|
||||
else if (shared->zookeeper->expired())
|
||||
shared->zookeeper = shared->zookeeper->startNewSession();
|
||||
|
||||
@ -1507,6 +1509,8 @@ void Context::resetZooKeeper() const
|
||||
void Context::reloadZooKeeperIfChanged(const ConfigurationPtr & config) const
|
||||
{
|
||||
std::lock_guard lock(shared->zookeeper_mutex);
|
||||
shared->zookeeper_config = config;
|
||||
|
||||
if (!shared->zookeeper || shared->zookeeper->configChanged(*config, "zookeeper"))
|
||||
{
|
||||
shared->zookeeper = std::make_shared<zkutil::ZooKeeper>(*config, "zookeeper");
|
||||
|
Loading…
Reference in New Issue
Block a user