From 4b117356809224aaf5697addd388f785c0e23f29 Mon Sep 17 00:00:00 2001 From: Alexander Tokmakov Date: Tue, 20 Feb 2024 22:41:49 +0100 Subject: [PATCH] fix auxiliary zookeepers --- src/Common/ZooKeeper/ZooKeeper.cpp | 4 ++-- src/Common/ZooKeeper/ZooKeeperArgs.cpp | 4 +++- src/Common/ZooKeeper/ZooKeeperArgs.h | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Common/ZooKeeper/ZooKeeper.cpp b/src/Common/ZooKeeper/ZooKeeper.cpp index 30c87723818..93568909041 100644 --- a/src/Common/ZooKeeper/ZooKeeper.cpp +++ b/src/Common/ZooKeeper/ZooKeeper.cpp @@ -976,7 +976,7 @@ ZooKeeperPtr ZooKeeper::startNewSession() const void ZooKeeper::initSession() { - String session_path = fs::path(args.sessions_path) / toString(DB::ServerUUID::get()); + String session_path = fs::path(args.sessions_path) / args.zookeeper_name / toString(DB::ServerUUID::get()); Coordination::Stat stat; if (trySet(session_path, "", -1, &stat) == Coordination::Error::ZOK) { @@ -991,7 +991,7 @@ void ZooKeeper::initSession() void ZooKeeper::addCheckSessionOp(Coordination::Requests & requests) const { - String session_path = fs::path(args.sessions_path) / toString(DB::ServerUUID::get()); + String session_path = fs::path(args.sessions_path) / args.zookeeper_name / toString(DB::ServerUUID::get()); requests.push_back(zkutil::makeCheckRequest(session_path, session_node_version)); } diff --git a/src/Common/ZooKeeper/ZooKeeperArgs.cpp b/src/Common/ZooKeeper/ZooKeeperArgs.cpp index 00797217847..40bd9d79a03 100644 --- a/src/Common/ZooKeeper/ZooKeeperArgs.cpp +++ b/src/Common/ZooKeeper/ZooKeeperArgs.cpp @@ -132,6 +132,8 @@ void ZooKeeperArgs::initFromKeeperServerSection(const Poco::Util::AbstractConfig void ZooKeeperArgs::initFromKeeperSection(const Poco::Util::AbstractConfiguration & config, const std::string & config_name) { + zookeeper_name = config_name; + Poco::Util::AbstractConfiguration::Keys keys; config.keys(config_name, keys); @@ -195,7 +197,7 @@ void ZooKeeperArgs::initFromKeeperSection(const Poco::Util::AbstractConfiguratio } else if (key == "sessions_path") { - chroot = config.getString(config_name + "." + key); + sessions_path = config.getString(config_name + "." + key); } else if (key == "implementation") { diff --git a/src/Common/ZooKeeper/ZooKeeperArgs.h b/src/Common/ZooKeeper/ZooKeeperArgs.h index 8d816fb00b0..e7d80b2358b 100644 --- a/src/Common/ZooKeeper/ZooKeeperArgs.h +++ b/src/Common/ZooKeeper/ZooKeeperArgs.h @@ -29,6 +29,7 @@ struct ZooKeeperArgs ZooKeeperArgs() = default; bool operator == (const ZooKeeperArgs &) const = default; + String zookeeper_name = "zookeeper"; String implementation = "zookeeper"; Strings hosts; String auth_scheme;